[openstack-dev] [OSLO][RPC] AMQP / ZeroMQ control_exchange vs port numbers

Mark McLoughlin markmc at redhat.com
Mon Apr 29 15:25:37 UTC 2013


On Mon, 2013-04-29 at 10:43 -0400, Doug Hellmann wrote:
> 
> 
> 
> On Mon, Apr 29, 2013 at 7:00 AM, Mark McLoughlin <markmc at redhat.com> wrote:
>         On Fri, 2013-04-26 at 15:18 -0400, Doug Hellmann wrote:
>         
>         > We've gone around a few times with ideas for having better driver-parity in
>         > the rpc library, so maybe the best thing to do is start by making sure we
>         > have all of the requirements lined up. Here's a list of some that I came up
>         > with based on existing features and my understanding of the shortcomings
>         > (numbered for reference, but in no particular order):
>         
>         
>         Thanks for doing this. We definitely need to be stepping back and
>         thinking about this at a high level. I've attempted to step a little
>         further back in my writeup:
>         
>           https://wiki.openstack.org/wiki/Oslo/Messaging
> 
> 
> A few comments/questions on that:

All good questions, thanks Doug.

> In the client, it seems like the rpc.Target() should be passed to the
> RPCClient constructor, rather than specified as a class attribute.

I was seeing the class attribute as being the defaults for method
invocations ... to make those defaults be per instance, you could do
something like:

  class BaseAPIClient(rpc.RPCClient):

      def __init__(self, driver,
                   topic='blaa', version='1.0', namespace='baseapi'):
          self.target = rpc.Target(topic=topic,
                                   version=version,
                                   namespace=namespace)

... but maybe the point here is that we never expect this class to be
used with a different topic, version or namespace.

>  The target parameters should include the host (or "peer" to use
> Eric's terminology), shouldn't it?

Yes, absolutely:

      def get_backdoor_port(self, context, host):
          self.call(self.target(version='1.1', host=host),
                    'get_backdoor_port', context)

The host would be added to the default target parameters at method
invocation time.

Note, though, this is about a client specifying one of a pool of
listening servers ... it's certainly not a peer of a client, and we're
not talking about peers at the transport level either.

> On the server side, I like separating the dispatcher from the server,
> but I wonder if the server needs to know about the dispatcher at all?
> Why not just give the server a single callable, which might be a
> Dispatcher instance? It isn't clear why the dispatcher has start() and
> stop() methods, either, but maybe that has something to do with this
> design.

Yeah, exactly.

In BlockingDispatcher, start() would read messages and dispatch them to
the API objects we have listening on this topic and stop() would cause
that dispatch loop to exit.

In EventletDispatch, start() would spawn off a greenthread to do the
dispatching and stop() would cancel the thread.

That said, this part of the proposal doesn't feel very solid yet.

> In web frameworks the decorator for exposing a method is usually named
> something like "expose" so how about rpc.expose instead of rpc.method?

Sounds good, updated.

> Is fake_rabbit used for testing? If so, that transport should be its
> own driver.

>From a quick grep, it looks like it just enables the in-memory RabbitMQ
transport. Maybe it should just be a parameter to the kombu transport
driver.

Cheers,
Mark.





More information about the OpenStack-dev mailing list