2838 Commits

Author SHA1 Message Date
Flaper Fesp
ff2c04834f Add parse_url to _utils.
The patch adds parse_url to _utils as an attempt to find a common url
format that satisfies most drivers needs. The code isn't definitive but
instead the beginning for further discussions. Current code parses
transport urls like this:

qpid://test/test
{'exchange': 'test',
 'hosts': [{'host': 'test', 'password': '', 'username': ''}],
 'parameters': {},
 'transport': 'qpid'}

qpid://test:port/test
{'exchange': 'test',
 'hosts': [{'host': 'test:port', 'password': '', 'username': ''}],
 'parameters': {},
 'transport': 'qpid'}

qpid://username:password@test:port/test
{'exchange': 'test',
 'hosts': [{'host': 'test:port',
            'password': 'password',
            'username': 'username'}],
 'parameters': {},
 'transport': 'qpid'}

qpid://username:password@test:port
{'exchange': None,
 'hosts': [{'host': 'test:port',
            'password': 'password',
            'username': 'username'}],
 'parameters': {},
 'transport': 'qpid'}

qpid://username:password@test:port,test2:port2/test
{'exchange': 'test',
 'hosts': [{'host': 'test:port',
            'password': 'password',
            'username': 'username'},
           {'host': 'test2:port2',
            'password': 'password',
            'username': 'username'}],
 'parameters': {},
 'transport': 'qpid'}

qpid://username:password@test:port,:@test2:port2/test
{'exchange': 'test',
 'hosts': [{'host': 'test:port',
            'password': 'password',
            'username': 'username'},
           {'host': 'test2:port2', 'password': '', 'username': ''}],
 'parameters': {},
 'transport': 'qpid'}

qpid://username:password@test:port,:@test2:port2/test?option=value
{'exchange': 'test',
 'hosts': [{'host': 'test:port',
            'password': 'password',
            'username': 'username'},
           {'host': 'test2:port2', 'password': '', 'username': ''}],
 'parameters': {'option': ['value']},
 'transport': 'qpid'}
2013-05-21 15:34:14 +02:00
Mark McLoughlin
d559a86ec9 Remove entry point lists from the public API
Before the move to pbr, I thought it would be cute to include the lists
of entry points in the public API. After pbr, the entry points are only
in a config file, so it doesn't make much sense.
2013-05-20 07:24:53 +01:00
Russell Bryant
ab26987133 Support capping message versions in the client.
When doing a rolling upgrade, we need to be able to tell all rpc clients
to hold off on sending newer versions of messages until all nodes
understand the new message version.  This patch adds the oslo component
of this.

It's quite simple.  The rpc proxy just stores the version cap and will
raise an exception if code ever tries to send a message that exceeds
this cap.

Allowing the cap to be configured and generating different types of
messages based on the configured value is the hard part here, but that
is left up to the project using the rpc library.

Implements blueprint rpc-version-control.
2013-05-15 16:39:04 -04:00
Mark McLoughlin
704f2c3319 Fix RPCClient check_for_lock()
Missing self parameter. Also no need for the return value.
2013-05-20 07:05:52 +01:00
Mark McLoughlin
e8429af763 First cut at the notifier API
See:

  https://wiki.openstack.org/wiki/Oslo/Messaging#Emitting_Notifications
2013-05-17 18:48:55 +01:00
Mark McLoughlin
48a1cfae8a Add some notes 2013-05-13 11:42:09 +01:00
Mark McLoughlin
a7c47bf16b Add IncomingMessage abstraction
When an executor polls for a message, the driver needs to return the
request context and the message.

Later, if the executor wishes to send a reply, it needs to pass back
a handle which identifies the message so that the transport can deliver
the reply.

In the current interface, we're just passing back the context and
message to the transport so this presumes that the transport would
attach whatever it needs to one of these objects.

In the AMQP drivers in openstack.common.rpc, we set attributes like
reply_q and msg_id on the returned context. However, it would be much
better if we never touched the user-supplied context and, instead, had
some other way to pass this info to the executor and then have it passed
back to the transport.

To achieve that, add an IncomingMessage abstract class which wraps the
context and message and has a reply() method. That way, transports can
subclass this class, add whatver attributes they want and implement a
reply method.

To repeat what this means ... we can allow users of the API to use
read-only mapping objects as a context, rather than requiring it to be
an object we can set arbitrary attributes on.
2013-05-13 11:33:41 +01:00
Mark McLoughlin
07534f47a5 Pass a context dict
Plumb a context dict all the way through the stack.

This is ugly, but:

  - it seems valid to have generic support for a message context
    that is implicitly included in all RPC interfaces

  - rabbit/qpid serialize the context differently, so we really
    need to pass it all the way down to the transport to continue
    to support this

  - notifications also send a context, so it's not rpc specific
2013-05-13 07:46:34 +01:00
Flaper Fesp
70c42e6336 Fix docstring 2013-05-13 12:31:10 +02:00
Mark McLoughlin
e2b74cc9e6 Implement a fake driver
A bunch of FIXMEs in here, but it seems like a good start.

Note that this differs from the original fake driver. Rather than the
driver consuming each message in a greenthread, we leave it up to the
choice of executor to determine how the consumer is run in parallel to
the client and we use thread-safe queues to pass the messages and
replies back and forth. The main reason for this is that we don't want
the driver explicitly depending on eventlet.
2013-05-10 15:46:55 +01:00
Mark McLoughlin
4771afb5e2 Adding reply infrastructure
This is pretty rough.
2013-05-11 13:19:59 +01:00
Mark McLoughlin
9a7eb04e13 Add some exceptions 2013-05-11 17:39:31 +01:00
Mark McLoughlin
eb77cbdb6d Fix buglet with default timeout 2013-05-11 17:46:27 +01:00
Mark McLoughlin
27868dd24d Fix target/namespace target buglet 2013-05-11 16:33:33 +01:00
Mark McLoughlin
79f0938613 Fix rpc client buglets 2013-05-11 16:18:36 +01:00
Mark McLoughlin
2e26a082d4 Fix 'Blockinging' typos 2013-05-11 16:23:13 +01:00
Mark McLoughlin
1353bafb7e Missing self parameter to server start() 2013-05-11 16:22:53 +01:00
Mark McLoughlin
246fb5235e Fix default_exchange typo 2013-05-11 16:22:37 +01:00
Mark McLoughlin
bb5d6d94d5 Add forgotten piece of eventlet executor 2013-05-11 13:20:41 +01:00
Mark McLoughlin
7492f2d9ea It's _executors not _executor 2013-05-11 13:20:21 +01:00
Mark McLoughlin
93447e8381 Make poll() just return the message
The driver shouldn't be pulling the namespace and version from the
message since that's RPC specific stuff.

Also, it's not terribly useful for the driver to pass back a target
object describing the exchange and topic the message was received on
since that's implicit in the listener.
2013-05-11 16:17:00 +01:00
Mark McLoughlin
7c3697f77b Make drivers list public again
Make the list of drivers public via the o.c.m.drivers module.
2013-05-11 13:18:43 +01:00
Mark McLoughlin
e8a0756a3a Add top-level convenience aliases
This means you can do e.g.

  from openstack.common import messaging

  target = messaging.Target(...)

  transport = messaging.get_transport(...)

  class Client(messaging.RPCClient):
     ...

rather than e.g.

  from openstack.common.messaging.rpc import client
  from openstack.common.messaging import target
  from openstack.common.messaging import transport

  target = target.Target(...)

  transport = transport.get_transport(...)

  class Client(client.RPCClient):
     ...
2013-05-11 13:57:51 +01:00
Mark McLoughlin
1fd958678f Prefix the executors module with underscore
With the MessagingServer API now private, we don't actually need to
expose the concept of an executor.

We may find in future that we want to support an executor type which
we don't want to include in the library itself but, for now, let's
be conservative.
2013-05-10 16:07:21 +01:00
Mark McLoughlin
5675f2603e Prefix the messaging.server module with an underscore
I'm assuming for now that we'll have a specific notifications
consumption API which will use this as an internal implementation
detail. We can make this public again in future if/when we know
what the use case for it is.
2013-05-10 16:04:10 +01:00
Mark McLoughlin
ae6019ff82 Prefix the drivers module with an underscore
To make it clear that the drivers API isn't public and stable.

See the discussion in:

  https://github.com/markmc/oslo-incubator/pull/3
2013-05-10 16:00:42 +01:00
Mark McLoughlin
d588b49cd0 Make transport methods private
These methods are private to the library, so we're prefixing them
with an underscore even though it's a bit unconventional.

See the discussion here:

  https://github.com/markmc/oslo-incubator/pull/3
2013-05-10 15:48:48 +01:00
Mark McLoughlin
ea2e34f37a Fix little typo in server exception class name 2013-05-10 12:52:21 +01:00
Mark McLoughlin
e54343ba15 Add missing utils module 2013-05-10 12:33:00 +01:00
Mark McLoughlin
a136bb089d Add convenience RPC server classes
Rather than forcing all users of the server API to construct a
dispatcher and import a specific executor, add a convenience server
class e.g.

  server = eventlet.EventletRPCServer(transport, target, endpoints)

Note that openstack.common.messaging.eventlet need be the only public
module which has a dependency on eventlet. We can expose servers,
clients and anything else eventlet specific through this part of the
API.
2013-05-10 12:16:16 +01:00
Mark McLoughlin
e14ddb80e5 Update changes.txt for recent API changes 2013-05-10 12:06:20 +01:00
Flaper Fesp
2405fd2619 Use : for loading classes in entry_points 2013-05-08 16:55:56 +02:00
Doug Hellmann
5fb15b61f5 Split the dispatcher from the executor and server
Move the executors into a sub-package and organize the
code so that only one module imports eventlet.

Rename messaging/rpc/server.py to messaging/rpc/dispatcher.py and
leave only the dispatcher there.

Move the rest of the server code to messaging/server.py where it
can be reused with other dispatchers.

Remove the convenience functions for instantiating servers
to avoid having eventlet imported in the module with the base
class.

Signed-off-by: Doug Hellmann <doug.hellmann@dreamhost.com>
2013-05-06 16:05:10 -04:00
Doug Hellmann
c7e204279b Make driver and transport methods public
The methods of the driver and transport should
be public, since they are used outside of those
classes.

Signed-off-by: Doug Hellmann <doug.hellmann@dreamhost.com>
2013-05-06 15:29:37 -04:00
Flaper Fesp
3a910e8f72 Pass the driver instance to the listener instead of config
There are a couple of cases where having the driver instance is a good
thing for the Listener, though, I would like to use the connection
management as motivation here:

Instead of creating a new connection for every Listener it would be
possible to let the driver instance managing the whole connect /
reconnect and session handling process.

In the old implementation, when a reconnect happens, the connection
instance calls every consumer and sets the new connection / session to
them.

See: http://github.com/openstack/oslo-incubator/blob/master/openstack/common/rpc/impl_qpid.py#L368

Listeners can access the config instance through the driver instance.
2013-05-06 20:54:12 +02:00
Mark McLoughlin
fb67f72375 Try out replacing "executor" for "dispatcher"
Suggestion from Doug
2013-05-04 11:12:43 +01:00
Mark McLoughlin
6199614494 Fix host vs server typo
Thanks to Eric
2013-05-03 15:20:38 +01:00
Mark McLoughlin
20c3674021 Initial framework 2013-04-30 06:49:56 +01:00