A pure python, thread-safe, minimalistic and pythonic RabbitMQ client library
Project description
rabbitpy - rabbitmq simplified
A pure python, thread-safe, minimalistic and pythonic BSD Licensed AMQP/RabbitMQ library that supports Python 2.6+ and Python 3.2+. Previously named rmqid.
Installation
rabbitpy may be installed via the Python package index with the tool of your choice. I prefer pip:
pip install rabbitpy
But there’s always easy_install:
easy_install rabbitpy
rmqid Compatibility
rabbitpy is API compatible with rmqid.
Documentation
Requirements
pamqp - https://github.com/pika/pamqp
requests - http://docs.python-requests.org/
Python3 Caveats
Message bodies must use the bytes data type while most other values are strings.
Examples
Simple Publisher
The simple publisher is ideal for sending one off messages:
>>> rabbitpy.publish('amqp://guest:guest@localhost:5672/%2f', exchange='test', routing_key='example', body='This is my test message')
If you want to add properties:
>>> rabbitpy.publish('amqp://guest:guest@localhost:5672/%2f', exchange='test', routing_key='example', body='This is my test message', properties={'content_type': 'text/plain'})
And publisher confirms:
>>> rabbitpy.publish('amqp://guest:guest@localhost:5672/%2f', exchange='test', routing_key='example', body='This is my test message', properties={'content_type': 'text/plain'}, confirm=True) True >>>
Simple Getter
>>> m = rabbitpy.get('amqp://guest:guest@localhost:5672/%2f', 'test') >>> m.json() {u'foo': u'bar'}
Simple Consumer
>>> with rabbitpy.consume('amqp://guest:guest@localhost:5672/%2f', 'test') as c: .. for message in c.next_message(): ... print message.properties['message_id'] ... print message.body ... message.ack() ... 856dfdc7-5ee3-4fc1-9635-977bf0043a9f {"foo": "bar"}
More complex examples are available at https://rabbitpy.readthedocs.org
Version History
0.10.0: Rewrite of IO layer yielding improved performance and reduction of CPU usage, bugfixes
0.9.0: Major performance improvements, CPU usage reduction, minor bug-fixes
0.8.0: Major bugfixes, IPv6 support
0.7.0: Bugfixes and code cleanup. Most notable fix around Basic.Return and recursion in Channel._wait_on_frame.
0.6.0: Bugfix with Queue.get(), RPC requests expecting multiple responses and the new Queue.consume_messages() method.
0.5.1: Installer/setup fix
0.5.0: Bugfix release including low level socket sending fix and connection timeouts.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file rabbitpy-0.10.0.tar.gz
.
File metadata
- Download URL: rabbitpy-0.10.0.tar.gz
- Upload date:
- Size: 28.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7e93c2d3199e50cd40cddb95e1cb0860b6decf5583718c5787c12c63b70d7054 |
|
MD5 | aed211b7133c5d7f0bfa8744f462252b |
|
BLAKE2b-256 | 6e821d8dc6a5414a31db8c7210275f90f578a669a88b68450225b635efbbd37c |