Source: factory.core/ObjMessageQueue.py
Handles message queue interactions, including connecting to a RabbitMQ server, creating
queues, and pushing messages. This class is primarily designed to work with RabbitMQ,
supporting both local and remote configurations, while integrating settings from
external configuration files when necessary.
...
| Method | Signature | Description |
|---|---|---|
| Connect | Connect(counter: int = 0) |
|
| connect_rabbit | connect_rabbit() -> None |
Establishes a connection to a RabbitMQ broker using the pika library. This method |
| create_queue | create_queue(context: str, queue: str, counter = 0) |
Creates a queue on a message broker and attempts retries on failure. |
| push | push(context: str, queue: str, guid: str, payload: dict, mq_table_base: str = '', mq_table_key: str = 'guid', mq_table_status: str = 'status', mq_stage_guids: list = []) -> None |
Pushes a payload to a specific message queue or updates its status in a database if |
| qsize | qsize() |
|
| count | count(context: str, queue: str) -> None |
Counts the size of a specific queue within a given context and returns the queue size. |
| pop | pop(context: str, queue: str) |
Retrieves and processes messages from a specified queue using the RabbitMQ architecture or an equivalent |
| pop_list | pop_list(context, queue, max: int = MQ_QOS_BUFFER) |
Retrieves and processes a list of messages from a local queue or the RabbitMQ server. The method |
| load | load(context: str, queue: str, sql: str = '', connection: str = '', ConnectionName: str = '', mongo_collection: str = '', mq_task: str = '', mq_table_base: str = '', mq_table_key: str = '', mq_table_status: str = '') -> int |
Loads data into the message queue from either an SQL database or a MongoDB collection, depending on the |
| status | status(context: str, queue: str) -> str |
Determines and returns the current status of a queue, including pending, staged, |