This Page

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

The nova.rpc.impl_carrot Module

AMQP-based RPC.

Queues have consumers and publishers.

No fan-out support yet.

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

Bases: nova.rpc.impl_carrot.Consumer

Calls methods on a proxy object based on method and args.

process_data(message_data, message)

Consumer callback to call a method on a proxy object.

Parses the message for validity and fires off a thread to call the proxy object method.

Message data should be a dictionary with two keys:
method: string representing the method to call args: dictionary of arg: value

Example: {‘method’: ‘echo’, ‘args’: {‘value’: 42}}

class nova.rpc.impl_carrot.Connection(*args, **kwargs)

Bases: carrot.connection.BrokerConnection

Connection instance object.

cancel_consumer_thread()

Cancel a consumer thread

close()
consume_in_thread()

Consumer from all queues/consumers in a greenthread

create_consumer(topic, proxy, fanout=False)

Create a consumer that calls methods in the proxy

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.impl_carrot.Consumer(*args, **kwargs)

Bases: carrot.messaging.Consumer

Consumer base class.

Contains methods for connecting the fetch method to async loops.

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

Wraps the parent fetch with some logic for failed connection.

class nova.rpc.impl_carrot.ConsumerSet(connection, consumer_list)

Bases: object

Groups consumers to listen on together on a single connection.

close()
init(conn)
reconnect()
wait(limit=None)
class nova.rpc.impl_carrot.DirectConsumer(connection=None, msg_id=None)

Bases: nova.rpc.impl_carrot.Consumer

Consumes messages directly on a channel specified by msg_id.

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

Bases: nova.rpc.impl_carrot.Publisher

Publishes messages directly on a channel specified by msg_id.

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

Bases: nova.rpc.impl_carrot.AdapterConsumer

Consumes messages from a fanout exchange.

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

Bases: nova.rpc.impl_carrot.Publisher

Publishes messages to a fanout exchange.

class nova.rpc.impl_carrot.MulticallWaiter(consumer)

Bases: object

close()
wait()
class nova.rpc.impl_carrot.Pool(min_size=0, max_size=4, order_as_stack=False, create=None)

Bases: eventlet.pools.Pool

Class that implements a Pool of Connections.

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

Bases: carrot.messaging.Publisher

Publisher base class.

class nova.rpc.impl_carrot.RpcContext(*args, **kwargs)

Bases: nova.context.RequestContext

reply(*args, **kwargs)
class nova.rpc.impl_carrot.TopicAdapterConsumer(connection=None, topic='broadcast', proxy=None)

Bases: nova.rpc.impl_carrot.AdapterConsumer

Consumes messages on a specific topic.

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

Bases: nova.rpc.impl_carrot.Publisher

Publishes messages on a specific topic.

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

Sends a message on a topic and wait for a response.

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

Sends a message on a topic without waiting for a response.

nova.rpc.impl_carrot.create_connection(new=True)

Create a connection

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

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

nova.rpc.impl_carrot.generic_response(message_data, message)

Logs a result and exits.

nova.rpc.impl_carrot.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.impl_carrot.multicall(context, topic, msg)

Make a call that returns multiple times.

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

Sends a message for testing.