# 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 `.
Metadata
Release files for aioamqp-ext 0.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| aioamqp_ext-0.1.5.tar.gz | 3.7 kB | Details |
Release files / aioamqp_ext-0.1.5.tar.gz
| Download URL | aioamqp_ext-0.1.5.tar.gz |
|---|---|
| Size | 3.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
80c5d9225ad653b3c16ab9528757e2e2c199aa5f5c971fd0fbca6899caa4c4fb
|
|
BLAKE2b-256 checksum How to use checksums |
75ffd9378acbcc6f944d8082955d8b8a727d39b59135c2c84bdba60ef3c789c2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |