messaging.backends package¶
Submodules¶
messaging.backends.amqp module¶
Backend supporting AMQP 0.9.1, specifically targeting RabbitMQ message broker
-
class
messaging.backends.amqp.
AMQPMessagingBackend
¶ Bases:
messaging.backends.backend.MessagingBackend
Backend supporting message passing via AMQP 0.9.1 broker, targeting RabbitMQ
-
get_queue_size
()¶ See
messaging.backends.backend.MessagingBackend.get_queue_size()
-
receive_messages
(batch_size)¶ See
messaging.backends.backend.MessagingBackend.receive_messages()
-
send_messages
(messages)¶ See
messaging.backends.backend.MessagingBackend.send_messages()
-
messaging.backends.backend module¶
-
class
messaging.backends.backend.
MessagingBackend
(backend_type)¶ Bases:
object
-
get_queue_size
()¶ Gets the current length of the queue
Returns: number of messages in the queue Return type: int
-
receive_messages
(batch_size)¶ Receive a batch of messages from the backend
Connections are not persisted across receive_messages calls. It is recommended that if a large number of messages are to be retrieved it be done directly in a single function call.
Implementing function must yield messages from backend. Messages must be in dict form. It is also the responsibility of the function to handle a boolean response and appropriately acknowledge / delete message on True
Parameters: batch_size (int) – Number of messages to be processed Returns: Yielded list of messages Return type: Generator[dict]
-
send_messages
(messages)¶ Send a collection of messages to the backend
Connections are not persisted across send_messages calls. It is recommended that if a large number of messages are to be sent it be done directly in a single function call.
Parameters: messages ([dict]) – JSON payload of messages
-
messaging.backends.factory module¶
Defines the factory for creating messaging backends
-
messaging.backends.factory.
add_message_backend
(backend_class)¶ Registers a backend so it can be used for Scale messaging
Parameters: backend_class (class:messaging.backends.Backend) – The class definition for a backend
-
messaging.backends.factory.
get_message_backend
(backend_type)¶ Returns a backend class of the given type
Parameters: backend_type (string) – The unique identifier of a registered message backend
-
messaging.backends.factory.
get_message_backends
()¶ Returns a list of type identifiers for all registered message backends
Returns: A list of messages backends Return type: [string]
messaging.backends.sqs module¶
Backend supporting Amazon SQS
-
class
messaging.backends.sqs.
SQSMessagingBackend
¶ Bases:
messaging.backends.backend.MessagingBackend
Backend supporting message passing via Amazon SQS
-
get_queue_size
()¶ See
messaging.backends.backend.MessagingBackend.get_queue_size()
-
receive_messages
(batch_size)¶ See
messaging.backends.backend.MessagingBackend.receive_messages()
-
send_messages
(messages)¶ See:meth:messaging.backends.backend.MessagingBackend.send_messages
-