Skip to main content

The zimran-events provides amqp interface

Project description

zimran-events

The zimran-py-events module provides AMQP interface

License: MIT code size

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

# < 0.4.0

from zimran.events import Consumer
from zimran.events.dto import Exchange

consumer = Consumer(service_name='my-service', broker_url='')
consumer.add_event_handler(
            name='routing-key',
            handler=handler_func,
            exchange=Exchange(
                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):
  ...



# >= 0.4.0 version


from zimran.events.routing import Router
from zimran.events.consumer AsyncConsumer


router = Router()

@router.event_handler('routing-key')
async def handler(message: aio_pika.IncomingMessage):
  pass


router.add_event_handler('routing-key', some_handler)



async def main():
  consumer = AsyncConsumer(..., router=router)

  await consumer.run()

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


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.4.8.tar.gz (15.0 kB view details)

Uploaded Source

Built Distribution

zimran_events-0.4.8-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

File details

Details for the file zimran-events-0.4.8.tar.gz.

File metadata

  • Download URL: zimran-events-0.4.8.tar.gz
  • Upload date:
  • Size: 15.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for zimran-events-0.4.8.tar.gz
Algorithm Hash digest
SHA256 e499b249a5450b092bb4b5f68357c75a5d30e1ed89a8679e058a4a353ee6fbbe
MD5 d824c2eae741ef03598c01e4c9b7d49f
BLAKE2b-256 b0929775979e8c25e474f1b19afdf2718d7fc00ea193f5ed7ff34869d745dbb7

See more details on using hashes here.

File details

Details for the file zimran_events-0.4.8-py3-none-any.whl.

File metadata

File hashes

Hashes for zimran_events-0.4.8-py3-none-any.whl
Algorithm Hash digest
SHA256 43f2471f9e10ed93f0d3e2873faedd03f58b7661158bea282383d621a46b590e
MD5 71fd1d68c24c7a35fcb1f3b0a2b0ed95
BLAKE2b-256 8d121c7557306fd2d01c357c556d2d018533b758d856501dbf235c6f7a3cce42

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page