The zimran-events provides amqp interface
Project description
zimran-contrib
The zimran-py-events
module provides AMQP interface
Installation
pip install zimran-events
Usage example
Producer
from zimran.events import AsyncProducer
producer = AsyncProducer(broker_url='')
await producer.connect()
# message publishing
await producer.publish('some.event.routing', {'msg': 'hello, world'})
Consumer
from zimran.events import Consumer
from zimran.events.schemas import ExchangeScheme
consumer = Consumer(service_name='my-service', broker_url='')
consumer.add_event_handler(
name='routing-key',
handler=handler_func,
exchange=ExchangeScheme(
name='exchange-name',
type='exchange-type',
durable=True,
)
)
# or
from zimran.events import Consumer
consumer = Consumer(service_name='my-service', broker_url='')
@consumer.event_handler('routing-key')
def handler_func(**kwargs):
...
Code
The code and issue tracker are hosted on GitHub: https://github.com/zimran-tech/zimran-py-events.git
Features
- AMQP interfaces
For contributors
Setting up development environment
Clone the project:
git clone https://github.com/zimran-tech/zimran-py-events.git
cd zimran-py-events
Create a new virtualenv:
python3 -m venv venv
source venv/bin/activate
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
zimran-events-0.2.4.tar.gz
(12.6 kB
view hashes)
Built Distribution
Close
Hashes for zimran_events-0.2.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 44b128592d25cfa240880ed0acb11d6afbc923e6a5a50f557f176d2cd9429d70 |
|
MD5 | fde22327156a7567d7d453d2b052f5f7 |
|
BLAKE2b-256 | b5bf76ec40c96cde9ee7a5e90bd60b38ec7e0f6f6c44d8eb193e5fef7b1419c4 |