# 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"
```
Raw data
{
"_id": null,
"home_page": null,
"name": "mq-misc",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "python, asyncio, utils, mq, aio_pika, rabbit mq, rabbit",
"author": "Anton Gorinenko",
"author_email": "anton.gorinenko@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/43/96/a03d37c2af0d8b872179041037aae0f2c834d8a23bc31d93805f320f934a/mq_misc-0.0.8.tar.gz",
"platform": null,
"description": "# RabbitMQ Utils\n\n## The basic API for working with RabbitMQ\n\n``BaseConsumer`` - the basic consumer of the message queue \n``Publisher`` - the basic publisher of the message queue\n``ReplyToConsumer`` - reply to consumer\n\n## MQ commands\n\n### Publish message\n\nPublishing a message to the queue\n\n```\npython -m mq_misc.publish [-h] [-m MESSAGE] [-f MESSAGE_FILE] -url AMQP_URL\n [-q QUEUE] [-e EXCHANGE] [--exchange_type EXCHANGE_TYPE]\n [-k ROUTING_KEY] [-to REPLY_TO] [-id CORRELATION_ID] [-w]\n\noptional arguments:\n -h, --help show this help message and exit\n -m MESSAGE, --message MESSAGE\n The message being sent [env var: RMQ_MESSAGE]\n (default: None)\n -f MESSAGE_FILE, --message-file MESSAGE_FILE\n File with the message [env var: RMQ_MESSAGE_FILE]\n (default: None)\n -to REPLY_TO, --reply_to REPLY_TO\n Commonly used to name a callback queue [env var:\n RMQ_REPLY_TO] (default: None)\n -id CORRELATION_ID, --correlation_id CORRELATION_ID\n Useful to correlate RPC responses with requests. [env\n var: RMQ_CORRELATION_ID] (default: None)\n -w, --waiting_response\n Waiting reply_to response. [env var:\n RMQ_WAITING_RESPONSE] (default: False)\n\nRabbit MQ options:\n -url AMQP_URL, --amqp-url AMQP_URL\n URL to use to connect to the rabbitmq [env var:\n RMQ_AMQP_URL] (default: None)\n -q QUEUE, --queue QUEUE\n Queue to use to connect to the rabbitmq [env var:\n RMQ_QUEUE] (default: None)\n -e EXCHANGE, --exchange EXCHANGE\n Exchange to use to connect to the rabbitmq [env var:\n RMQ_EXCHANGE] (default: None)\n --exchange_type EXCHANGE_TYPE\n Exchange type to use to connect to the rabbitmq [env\n var: RMQ_EXCHANGE_TYPE] (default: direct)\n -k ROUTING_KEY, --routing_key ROUTING_KEY\n Routing key for publish message [env var:\n RMQ_ROUTING_KEY] (default: None)\n\n\n```\n\nFor example\n\n```\npython -m mq_misc.publish -u \"amqp://guest:guest@localhost:5672/\" -e \"exchange_1\" --exchange_type \"topic\" --routing_key \"log.error\" -f \"message.json\" -w\npython -m mq_misc.publish -u \"amqp://guest:guest@localhost:5672/\" -q \"queue_1\" -f \"message.json\" -w\n```\n\n## Consume message\n\nConsuming a message from the queue\n\n```\nusage: python -m mq_misc.consume [-h] -url AMQP_URL [-q QUEUE] [-e EXCHANGE]\n [--exchange_type EXCHANGE_TYPE] [--ssl SSL]\n [--durable DURABLE] [--robust ROBUST]\n [--declare_exchange DECLARE_EXCHANGE] [-b BINDING_KEYS]\n [-pc PREFETCH_COUNT]\n\nIf an arg is specified in more than one place, then commandline values\noverride environment variables which override defaults.\n\noptional arguments:\n -h, --help show this help message and exit\n\nRabbit MQ options:\n -url AMQP_URL, --amqp-url AMQP_URL\n URL to use to connect to the rabbitmq [env var:\n RMQ_AMQP_URL] (default: None)\n -q QUEUE, --queue QUEUE\n Queue to use to connect to the rabbitmq [env var:\n RMQ_QUEUE] (default: None)\n -e EXCHANGE, --exchange EXCHANGE\n Exchange to use to connect to the rabbitmq [env var:\n RMQ_EXCHANGE] (default: None)\n --exchange_type EXCHANGE_TYPE\n Exchange type to use to connect to the rabbitmq [env\n var: RMQ_EXCHANGE_TYPE] (default: direct)\n --ssl SSL Use SSL for connection. [env var: RMQ_SSL] (default:\n false)\n --durable DURABLE Use durable connection. [env var: RMQ_DURABLE]\n (default: false)\n --robust ROBUST Make robust connection to the broker. [env var:\n RMQ_ROBUST] (default: false)\n --declare_exchange DECLARE_EXCHANGE\n Declare an exchange. [env var: RMQ_DECLARE_EXCHANGE]\n (default: false)\n -b BINDING_KEYS, --binding_keys BINDING_KEYS\n Binding keys separated by commas. [env var:\n RMQ_BINDING_KEYS] (default: None)\n -pc PREFETCH_COUNT, --prefetch_count PREFETCH_COUNT\n Consumer prefetch [env var: RMQ_PREFETCH_COUNT]\n (default: 10)\n```\n\nFor example\n\n```\npython -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\"\n```\n\n## Creating release tags\n\n```\ngit tag -a 0.0.6 -m \"Release 0.0.6\"\n```\n",
"bugtrack_url": null,
"license": null,
"summary": "Utility package for working with rabbitmq",
"version": "0.0.8",
"project_urls": null,
"split_keywords": [
"python",
" asyncio",
" utils",
" mq",
" aio_pika",
" rabbit mq",
" rabbit"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "9ce726dd51be6fd3d7e8cb681dc431c035e9bad3fb0c9f823ec60ee483a32916",
"md5": "a9fe3be2474768638e9ac01ef4ff8df5",
"sha256": "7687e988bd4d1351408a414b6a5b8f46b358bc0490af3c3f02ca5e52f7556369"
},
"downloads": -1,
"filename": "mq_misc-0.0.8-py3-none-any.whl",
"has_sig": false,
"md5_digest": "a9fe3be2474768638e9ac01ef4ff8df5",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 13497,
"upload_time": "2024-06-10T15:15:26",
"upload_time_iso_8601": "2024-06-10T15:15:26.980020Z",
"url": "https://files.pythonhosted.org/packages/9c/e7/26dd51be6fd3d7e8cb681dc431c035e9bad3fb0c9f823ec60ee483a32916/mq_misc-0.0.8-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "4396a03d37c2af0d8b872179041037aae0f2c834d8a23bc31d93805f320f934a",
"md5": "a09dbc7dfe01fcd63499c3c5b229e472",
"sha256": "398200199058e9ad8c6a4d8da31983f4d0ec9ca03035fa6f56e7feb1fd399628"
},
"downloads": -1,
"filename": "mq_misc-0.0.8.tar.gz",
"has_sig": false,
"md5_digest": "a09dbc7dfe01fcd63499c3c5b229e472",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 13656,
"upload_time": "2024-06-10T15:15:28",
"upload_time_iso_8601": "2024-06-10T15:15:28.539249Z",
"url": "https://files.pythonhosted.org/packages/43/96/a03d37c2af0d8b872179041037aae0f2c834d8a23bc31d93805f320f934a/mq_misc-0.0.8.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-06-10 15:15:28",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "mq-misc"
}