Add a comment to rpc.queue_get_for().

Part of blueprint common-rpc.

Add a comment to the rpc.queue_get_for() function that notes that this
is simply a naming convention and is dependent on how queues are set up
on the consumer side.

Change-Id: Ifa7d648e9b33ad2416236dc6966527c257baaf88
This commit is contained in:
Russell Bryant
2012-06-01 14:49:42 -04:00
parent 13cacffb57
commit 7dbaabaf40

View File

@@ -227,7 +227,20 @@ def fanout_cast_to_server(context, server_params, topic, msg):
def queue_get_for(context, topic, host):
"""Get a queue name for a given topic + host."""
"""Get a queue name for a given topic + host.
This function only works if this naming convention is followed on the
consumer side, as well. For example, in nova, every instance of the
nova-foo service calls create_consumer() for two topics:
foo
foo.<host>
Messages sent to the 'foo' topic are distributed to exactly one instance of
the nova-foo service. The services are chosen in a round-robin fashion.
Messages sent to the 'foo.<host>' topic are sent to the nova-foo service on
<host>.
"""
return '%s.%s' % (topic, host)