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_kombu Module

class nova.rpc.impl_kombu.Connection

Bases: object

Connection object.

cancel_consumer_thread()

Cancel a consumer thread

close()

Close/release this connection

connect_error(exc, interval)

Callback when there are connection re-tries by kombu

consume(limit=None)

Consume from all queues/consumers

consume_in_thread()

Consumer from all queues/consumers in a greenthread

create_consumer(topic, proxy, fanout=False)

Create a consumer that calls a method in a proxy object

declare_consumer(consumer_cls, topic, callback)

Create a Consumer using the class that was passed in and add it to our list of consumers

declare_direct_consumer(topic, callback)

Create a ‘direct’ queue. In nova’s use, this is generally a msg_id queue used for responses for call/multicall

declare_fanout_consumer(topic, callback)

Create a ‘fanout’ consumer

declare_topic_consumer(topic, callback=None)

Create a ‘topic’ consumer.

direct_send(msg_id, msg)

Send a ‘direct’ message

fanout_send(topic, msg)

Send a ‘fanout’ message

get_channel()

Convenience call for bin/clear_rabbit_queues

iterconsume(limit=None)

Return an iterator that will consume from all queues/consumers

publisher_send(cls, topic, msg)

Send to a publisher based on the publisher class

reconnect()

Handles reconnecting and re-estblishing queues

reset()

Reset a connection so it can be used again

topic_send(topic, msg)

Send a ‘topic’ message

class nova.rpc.impl_kombu.ConnectionContext(pooled=True)

Bases: object

The class that is actually returned to the caller of create_connection(). This is a essentially a wrapper around Connection that supports ‘with’ and can return a new Connection or one from a pool. It will also catch when an instance of this class is to be deleted so that we can return Connections to the pool on exceptions and so forth without making the caller be responsible for catching all exceptions and making sure to return a connection to the pool.

close()

Caller is done with this connection.

class nova.rpc.impl_kombu.ConsumerBase(channel, callback, tag, **kwargs)

Bases: object

Consumer base class.

cancel()

Cancel the consuming from the queue, if it has started

consume(*args, **kwargs)

Actually declare the consumer on the amqp channel. This will start the flow of messages from the queue. Using the Connection.iterconsume() iterator will process the messages, calling the appropriate callback.

If a callback is specified in kwargs, use that. Otherwise, use the callback passed during __init__()

If kwargs[‘nowait’] is True, then this call will block until a message is read.

Messages will automatically be acked if the callback doesn’t raise an exception

reconnect(channel)

Re-declare the queue after a rabbit reconnect

class nova.rpc.impl_kombu.DirectConsumer(channel, msg_id, callback, tag, **kwargs)

Bases: nova.rpc.impl_kombu.ConsumerBase

Queue/consumer class for ‘direct’

class nova.rpc.impl_kombu.DirectPublisher(channel, msg_id, **kwargs)

Bases: nova.rpc.impl_kombu.Publisher

Publisher class for ‘direct’

class nova.rpc.impl_kombu.FanoutConsumer(channel, topic, callback, tag, **kwargs)

Bases: nova.rpc.impl_kombu.ConsumerBase

Consumer class for ‘fanout’

class nova.rpc.impl_kombu.FanoutPublisher(channel, topic, **kwargs)

Bases: nova.rpc.impl_kombu.Publisher

Publisher class for ‘fanout’

class nova.rpc.impl_kombu.MulticallWaiter(connection)

Bases: object

done()
class nova.rpc.impl_kombu.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_kombu.ProxyCallback(proxy)

Bases: object

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

class nova.rpc.impl_kombu.Publisher(channel, exchange_name, routing_key, **kwargs)

Bases: object

Base Publisher class

reconnect(channel)

Re-establish the Producer after a rabbit reconnection

send(msg)

Send a message

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

Bases: nova.context.RequestContext

Context that supports replying to a rpc.call

reply(*args, **kwargs)
class nova.rpc.impl_kombu.TopicConsumer(channel, topic, callback, tag, **kwargs)

Bases: nova.rpc.impl_kombu.ConsumerBase

Consumer class for ‘topic’

class nova.rpc.impl_kombu.TopicPublisher(channel, topic, **kwargs)

Bases: nova.rpc.impl_kombu.Publisher

Publisher class for ‘topic’

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

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

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

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

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

Create a connection

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

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

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

Make a call that returns multiple times.