Skip to main content

Consumer utility for AMQP

Project description

aioamqp-consumer-best

PyPI version PyPI - Python Version Build Status codecov

Usage

import asyncio
from typing import List

from aioamqp_consumer_best import (
    ConnectionParams,
    Consumer,
    Exchange,
    Message,
    ProcessBulk,
    Queue,
    QueueBinding,
    ToBulks,
    load_json,
)


async def callback(messages: List[Message]) -> None:
    print(messages)


consumer = Consumer(
    middleware=(
        load_json
        | ToBulks(max_bulk_size=10, bulk_timeout=3.0)
        | ProcessBulk(callback)
    ),
    prefetch_count=10,
    queue=Queue(
        name='test-queue',
        bindings=[
            QueueBinding(
                exchange=Exchange('test-exchange'),
                routing_key='test-routing-key',
            ),
        ],
    ),
    connection_params=[  # Round robin
        ConnectionParams(),
        ConnectionParams.from_string('amqp://user@rmq-host:5672/'),
    ],
)

asyncio.run(consumer.start())

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

aioamqp-consumer-best-2.3.0.tar.gz (9.2 kB view details)

Uploaded Source

Built Distribution

aioamqp_consumer_best-2.3.0-py2.py3-none-any.whl (11.5 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file aioamqp-consumer-best-2.3.0.tar.gz.

File metadata

  • Download URL: aioamqp-consumer-best-2.3.0.tar.gz
  • Upload date:
  • Size: 9.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0

File hashes

Hashes for aioamqp-consumer-best-2.3.0.tar.gz
Algorithm Hash digest
SHA256 e0ea552c546597447218b929299015a860e0f1535535c0ee15436b74cc95e2ef
MD5 56fc2c92d80937631f00eb88921c5863
BLAKE2b-256 64fc1f09e2c69082683277b7228b91d30f9f4029a982ad46aa8f34662bcad29b

See more details on using hashes here.

Provenance

File details

Details for the file aioamqp_consumer_best-2.3.0-py2.py3-none-any.whl.

File metadata

  • Download URL: aioamqp_consumer_best-2.3.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 11.5 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0

File hashes

Hashes for aioamqp_consumer_best-2.3.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 e70a176d7fbb4b656dce81c99836369b7c8c1c70befc16c908e6191a7131204b
MD5 87508b73fb6668e73beae3f59c586031
BLAKE2b-256 8b75043a1d5a1515efa826e49ca6f9576c5e687889cec9cbc3d27f2f6aa24d21

See more details on using hashes here.

Provenance

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