This Page

Psst... hey. You're reading the latest content, but it might be out of sync with code. You can read Nova 2011.1 docs or all OpenStack docs too.

The nova.rpc Module

AMQP-based RPC. Queues have consumers and publishers. No fan-out support yet.

class nova.rpc.AdapterConsumer(connection=None, topic='broadcast', proxy=None)

Bases: nova.rpc.Consumer

Calls methods on a proxy object based on method and args

receive(*args, **kwargs)
class nova.rpc.Connection(hostname=None, userid=None, password=None, virtual_host=None, port=None, pool=None, **kwargs)

Bases: carrot.connection.BrokerConnection

Connection instance object

classmethod instance(new=True)

Returns the instance

classmethod recreate()

Recreates the connection instance

This is necessary to recover from some network errors/disconnects

class nova.rpc.Consumer(*args, **kwargs)

Bases: carrot.messaging.Consumer

Consumer base class

Contains methods for connecting the fetch method to async loops

attach_to_eventlet()

Only needed for unit tests!

fetch(no_ack=None, auto_ack=None, enable_callbacks=False)

Wraps the parent fetch with some logic for failed connections

class nova.rpc.DirectConsumer(connection=None, msg_id=None)

Bases: nova.rpc.Consumer

Consumes messages directly on a channel specified by msg_id

class nova.rpc.DirectPublisher(connection=None, msg_id=None)

Bases: nova.rpc.Publisher

Publishes messages directly on a channel specified by msg_id

class nova.rpc.FanoutAdapterConsumer(connection=None, topic='broadcast', proxy=None)

Bases: nova.rpc.AdapterConsumer

Consumes messages from a fanout exchange

class nova.rpc.FanoutPublisher(topic, connection=None)

Bases: nova.rpc.Publisher

Publishes messages to a fanout exchange.

class nova.rpc.Publisher(connection, exchange=None, routing_key=None, **kwargs)

Bases: carrot.messaging.Publisher

Publisher base class

exception nova.rpc.RemoteError(exc_type, value, traceback)

Bases: nova.exception.Error

Signifies that a remote class has raised an exception

Containes a string representation of the type of the original exception, the value of the original exception, and the traceback. These are sent to the parent as a joined string so printing the exception contains all of the relevent info.

class nova.rpc.TopicAdapterConsumer(connection=None, topic='broadcast', proxy=None)

Bases: nova.rpc.AdapterConsumer

Consumes messages on a specific topic

class nova.rpc.TopicPublisher(connection=None, topic='broadcast')

Bases: nova.rpc.Publisher

Publishes messages on a specific topic

nova.rpc.call(context, topic, msg)

Sends a message on a topic and wait for a response

nova.rpc.cast(context, topic, msg)

Sends a message on a topic without waiting for a response

nova.rpc.fanout_cast(context, topic, msg)

Sends a message on a fanout exchange without waiting for a response

nova.rpc.generic_response(message_data, message)

Logs a result and exits

nova.rpc.msg_reply(msg_id, reply=None, failure=None)

Sends a reply or an error on the channel signified by msg_id

failure should be a sys.exc_info() tuple.

nova.rpc.send_message(topic, message, wait=True)

Sends a message for testing