amqp_connector
qoa4ml.connector.amqp_connector
¶
Classes¶
AmqpConnector
¶
Functions¶
__init__(config, log=False)
¶
AmqpConnector handles the connection to an AMQP server for sending messages.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config
¶ |
AMQPConnectorConfig
|
Configuration settings for the AMQP connector. |
required |
log
¶ |
bool
|
A flag to enable logging of messages, default is False. |
False
|
Attributes:
Name | Type | Description |
---|---|---|
conf |
AMQPConnectorConfig
|
The AMQP connector configuration. |
exchange_name |
str
|
The name of the exchange to connect to. |
exchange_type |
str
|
The type of the exchange (e.g., 'direct', 'topic'). |
out_routing_key |
str
|
The routing key for outgoing messages. |
log_flag |
bool
|
Flag indicating whether to log messages. |
out_connection |
BlockingConnection
|
The connection to the RabbitMQ server. |
out_channel |
Channel
|
The channel for communication with RabbitMQ. |
Functions:
Name | Description |
---|---|
send_report |
Send data to the desired destination. |
get |
Get the current configuration of the connector. Initialize an instance of AmqpConnector. Parameters¶config : AMQPConnectorConfig Configuration settings for the AMQP connector. log : bool, optional A flag to enable logging of messages, default is False. |
get()
¶
Get the current configuration of the connector.
Returns:
Type | Description |
---|---|
AMQPConnectorConfig
|
The AMQP connector configuration. |
send_report(body_message, corr_id=None, routing_key=None, expiration=1000)
¶
Send data to the desired destination.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
body_message
¶ |
str
|
The message body to be sent. |
required |
corr_id
¶ |
str
|
The correlation ID for the message, default is None. |
None
|
routing_key
¶ |
str
|
The routing key for the message, default is None. |
None
|
expiration
¶ |
int
|
Message expiration time in milliseconds, default is 1000. |
1000
|
Notes
- If
corr_id
is not provided, a new UUID will be generated. - If
routing_key
is not provided, the defaultout_routing_key
will be used.