No project description provided
Project description
# Asynchronous AMQP base Consumer and Producer.
AMQP Consumer and Producer base classes. Working on top of `aioamqp`.
## Usage
Producer:
from aioamqp_ext import BaseProducer
producer = BaseProducer(**{
'url': 'amqp://localhost:5672/',
'exchange': 'my_exchange'
})
producer.publish_message(
payload='foo',
routing_key='bar'
)
producer.close()
Consumer:
from aioamqp_ext import BaseConsumer
class Consumer(BaseConsumer):
async def process_request(self, data):
print(data)
if __name__ == "__main__":
consumer = Consumer(**{
'url': 'amqp://localhost:5672/',
'exchange': 'my_exchange',
'queue': 'my_queue',
'routing_key': 'foo.bar'
})
try:
loop = asyncio.get_event_loop()
loop.run_until_complete(consumer.consume())
loop.run_forever()
except KeyboardInterrupt:
loop.run_until_complete(consumer.close())
finally:
loop.close()
## Tests
To run the tests, you'll need to install the Python test dependencies::
pip install -r ./requirements-ci.txt
Then you can run the tests with `make unit-test `.
AMQP Consumer and Producer base classes. Working on top of `aioamqp`.
## Usage
Producer:
from aioamqp_ext import BaseProducer
producer = BaseProducer(**{
'url': 'amqp://localhost:5672/',
'exchange': 'my_exchange'
})
producer.publish_message(
payload='foo',
routing_key='bar'
)
producer.close()
Consumer:
from aioamqp_ext import BaseConsumer
class Consumer(BaseConsumer):
async def process_request(self, data):
print(data)
if __name__ == "__main__":
consumer = Consumer(**{
'url': 'amqp://localhost:5672/',
'exchange': 'my_exchange',
'queue': 'my_queue',
'routing_key': 'foo.bar'
})
try:
loop = asyncio.get_event_loop()
loop.run_until_complete(consumer.consume())
loop.run_forever()
except KeyboardInterrupt:
loop.run_until_complete(consumer.close())
finally:
loop.close()
## Tests
To run the tests, you'll need to install the Python test dependencies::
pip install -r ./requirements-ci.txt
Then you can run the tests with `make unit-test `.
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
aioamqp_ext-0.1.5.tar.gz
(3.7 kB
view details)
File details
Details for the file aioamqp_ext-0.1.5.tar.gz
.
File metadata
- Download URL: aioamqp_ext-0.1.5.tar.gz
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 80c5d9225ad653b3c16ab9528757e2e2c199aa5f5c971fd0fbca6899caa4c4fb |
|
MD5 | f5946e06d49c31984611e5f80418e76f |
|
BLAKE2b-256 | 75ffd9378acbcc6f944d8082955d8b8a727d39b59135c2c84bdba60ef3c789c2 |