pynenc_rabbitmq.broker.rabbitmq_broker

Module Contents

Classes

RabbitMqBroker

A RabbitMq-based implementation of the broker for cross-process coordination.

API

class pynenc_rabbitmq.broker.rabbitmq_broker.RabbitMqBroker(app: pynenc.app.Pynenc)[source]

Bases: pynenc.broker.base_broker.BaseBroker

A RabbitMq-based implementation of the broker for cross-process coordination.

Uses RabbitMq queues for cross-process message coordination and implements all required abstract methods from BaseBroker. Connection retry with exponential backoff is handled automatically at the queue manager level.

Initialization

conf() pynenc_rabbitmq.conf.config_broker.ConfigBrokerRabbitMq
_message_queue() pynenc_rabbitmq.util.rabbitmq_queue_mng.QueueManager

Get the message queue manager.

send_message(invocation_id: pynenc.identifiers.invocation_id.InvocationId) None[source]

Send a message (invocation) to the queue.

route_invocation(invocation_id: pynenc.identifiers.invocation_id.InvocationId) None[source]

Route a single invocation by sending it to the message queue.

route_invocations(invocation_ids: list[pynenc.identifiers.invocation_id.InvocationId]) None[source]

Route multiple invocations by sending them to the message queue.

retrieve_invocation() pynenc.identifiers.invocation_id.InvocationId | None[source]

Retrieve a single invocation from the queue.

Returns:

The next DistributedInvocation in the queue, or None if empty.

count_invocations() int[source]

Count the number of invocations in the queue.

purge() None[source]

Clear all messages from the queue.