Catalog PyPI
Back to packageRELEASE DETAILS

0.1.5

PyPI

aioamqp-ext

# 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.

Published15 Nov 2017
Direct dependencies0
Transitive dependenciesNot calculated

README

Version 0.1.5 documentation
# 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 `.

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 0

Native requirements
0 direct targetsNot calculated transitive count
No declared dependencies in this collected response

Declarations describe requirements; they are not a resolved dependency graph.

Distribution files

1 collected
aioamqp_ext-0.1.5.tar.gz

sdist · 3.62 KB · Python source

Source file

Metadata history

Meaningful changes
Current collected state Current

Observed since 21 Oct, 11:36 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:2f5ceca416971897a12d7e8ad28d09c6806fcf669d52fbbdc9ad9e36cb430f73

Other collected versions

View all collected versions →