Utility package for working with rabbitmq
Project description
RabbitMQ Utils
The basic API for working with RabbitMQ
BaseConsumer
- the basic consumer of the message queue
Publisher
- the basic publisher of the message queue
ReplyToConsumer
- reply to consumer
MQ commands
Publish message
Publishing a message to the queue
python -m mq_misc.publish [-h] [-m MESSAGE] [-f MESSAGE_FILE] -url AMQP_URL
[-q QUEUE] [-e EXCHANGE] [--exchange_type EXCHANGE_TYPE]
[-k ROUTING_KEY] [-to REPLY_TO] [-id CORRELATION_ID] [-w]
optional arguments:
-h, --help show this help message and exit
-m MESSAGE, --message MESSAGE
The message being sent [env var: RMQ_MESSAGE]
(default: None)
-f MESSAGE_FILE, --message-file MESSAGE_FILE
File with the message [env var: RMQ_MESSAGE_FILE]
(default: None)
-to REPLY_TO, --reply_to REPLY_TO
Commonly used to name a callback queue [env var:
RMQ_REPLY_TO] (default: None)
-id CORRELATION_ID, --correlation_id CORRELATION_ID
Useful to correlate RPC responses with requests. [env
var: RMQ_CORRELATION_ID] (default: None)
-w, --waiting_response
Waiting reply_to response. [env var:
RMQ_WAITING_RESPONSE] (default: False)
Rabbit MQ options:
-url AMQP_URL, --amqp-url AMQP_URL
URL to use to connect to the rabbitmq [env var:
RMQ_AMQP_URL] (default: None)
-q QUEUE, --queue QUEUE
Queue to use to connect to the rabbitmq [env var:
RMQ_QUEUE] (default: None)
-e EXCHANGE, --exchange EXCHANGE
Exchange to use to connect to the rabbitmq [env var:
RMQ_EXCHANGE] (default: None)
--exchange_type EXCHANGE_TYPE
Exchange type to use to connect to the rabbitmq [env
var: RMQ_EXCHANGE_TYPE] (default: direct)
-k ROUTING_KEY, --routing_key ROUTING_KEY
Routing key for publish message [env var:
RMQ_ROUTING_KEY] (default: None)
For example
python -m mq_misc.publish -u "amqp://guest:guest@localhost:5672/" -e "exchange_1" --exchange_type "topic" --routing_key "log.error" -f "message.json" -w
python -m mq_misc.publish -u "amqp://guest:guest@localhost:5672/" -q "queue_1" -f "message.json" -w
Consume message
Consuming a message from the queue
usage: python -m mq_misc.consume [-h] -url AMQP_URL [-q QUEUE] [-e EXCHANGE]
[--exchange_type EXCHANGE_TYPE] [--ssl SSL]
[--durable DURABLE] [--robust ROBUST]
[--declare_exchange DECLARE_EXCHANGE] [-b BINDING_KEYS]
[-pc PREFETCH_COUNT]
If an arg is specified in more than one place, then commandline values
override environment variables which override defaults.
optional arguments:
-h, --help show this help message and exit
Rabbit MQ options:
-url AMQP_URL, --amqp-url AMQP_URL
URL to use to connect to the rabbitmq [env var:
RMQ_AMQP_URL] (default: None)
-q QUEUE, --queue QUEUE
Queue to use to connect to the rabbitmq [env var:
RMQ_QUEUE] (default: None)
-e EXCHANGE, --exchange EXCHANGE
Exchange to use to connect to the rabbitmq [env var:
RMQ_EXCHANGE] (default: None)
--exchange_type EXCHANGE_TYPE
Exchange type to use to connect to the rabbitmq [env
var: RMQ_EXCHANGE_TYPE] (default: direct)
--ssl SSL Use SSL for connection. [env var: RMQ_SSL] (default:
false)
--durable DURABLE Use durable connection. [env var: RMQ_DURABLE]
(default: false)
--robust ROBUST Make robust connection to the broker. [env var:
RMQ_ROBUST] (default: false)
--declare_exchange DECLARE_EXCHANGE
Declare an exchange. [env var: RMQ_DECLARE_EXCHANGE]
(default: false)
-b BINDING_KEYS, --binding_keys BINDING_KEYS
Binding keys separated by commas. [env var:
RMQ_BINDING_KEYS] (default: None)
-pc PREFETCH_COUNT, --prefetch_count PREFETCH_COUNT
Consumer prefetch [env var: RMQ_PREFETCH_COUNT]
(default: 10)
For example
python -m mq_misc.consume -u "amqp://guest:guest@localhost:5672/" -q "queue_1" -e "exchange_1" --exchange_type "topic" -b "log.level.*" --durable "true" --robust "true" --declare_exchange "true"
Creating release tags
git tag -a 0.0.6 -m "Release 0.0.6"
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
mq_misc-0.0.9.tar.gz
(13.6 kB
view details)
Built Distribution
mq_misc-0.0.9-py3-none-any.whl
(13.5 kB
view details)
File details
Details for the file mq_misc-0.0.9.tar.gz
.
File metadata
- Download URL: mq_misc-0.0.9.tar.gz
- Upload date:
- Size: 13.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | af61bc93c7619aa10e9d47c2963b1660aa9cae1318d8e11defbaeea4857176af |
|
MD5 | c337ac2079762b2f25fedd677d148109 |
|
BLAKE2b-256 | 2a635cae405eae65ebe90927afd6c19a99a5ca1f606799b156f1d97a112dbad7 |
File details
Details for the file mq_misc-0.0.9-py3-none-any.whl
.
File metadata
- Download URL: mq_misc-0.0.9-py3-none-any.whl
- Upload date:
- Size: 13.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bc44a943cb36070b3d2c63f5bd6102ca42b25f8cdd3b1ef6aff6b373dcb63be0 |
|
MD5 | bc52255d4878648dba343f7227c27e99 |
|
BLAKE2b-256 | 104c13df5175c84d50037657eaaeeeae0fa21b3d8204d2feeadc5e39c576ba28 |