diff options
author | Sandy Walsh <sandy.walsh@rackspace.com> | 2011-03-03 16:28:04 -0400 |
---|---|---|
committer | Sandy Walsh <sandy.walsh@rackspace.com> | 2011-03-03 16:28:04 -0400 |
commit | 2a6ce075e19af5700960e3fb22c213e43a2e24b4 (patch) | |
tree | 98798b930a626493d7841e763100eb8505b49097 /nova/rpc.py | |
parent | c297880fb7c007aa4f6b6a9f7b985ecc981d8fe2 (diff) | |
download | nova-2a6ce075e19af5700960e3fb22c213e43a2e24b4.tar.gz nova-2a6ce075e19af5700960e3fb22c213e43a2e24b4.tar.xz nova-2a6ce075e19af5700960e3fb22c213e43a2e24b4.zip |
start of fanout
Diffstat (limited to 'nova/rpc.py')
-rw-r--r-- | nova/rpc.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/nova/rpc.py b/nova/rpc.py index 8fe4565dd..a02cdc90c 100644 --- a/nova/rpc.py +++ b/nova/rpc.py @@ -218,6 +218,16 @@ class TopicPublisher(Publisher): super(TopicPublisher, self).__init__(connection=connection) +class FanoutPublisher(Publisher): + """Publishes messages to a fanout exchange.""" + exchange_type = "fanout" + + def __init__(self, topic, connection=None): + self.exchange = "%s_fanout" % topic + self.durable = False + super(FanoutPublisher, self).__init__(connection=connection) + + class DirectConsumer(Consumer): """Consumes messages directly on a channel specified by msg_id""" exchange_type = "direct" @@ -360,6 +370,16 @@ def cast(context, topic, msg): publisher.close() +def fanout_cast(context, topic, msg): + """Sends a message on a fanout exchange without waiting for a response""" + LOG.debug(_("Making asynchronous fanout cast...")) + _pack_context(msg, context) + conn = Connection.instance() + publisher = FanoutPublisher(topic, connection=conn) + publisher.send(msg) + publisher.close() + + def generic_response(message_data, message): """Logs a result and exits""" LOG.debug(_('response %s'), message_data) |