Consumer utility for AMQP
Project description
aioamqp-consumer-best
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
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
Built Distribution
File details
Details for the file aioamqp-consumer-best-2.2.1.tar.gz
.
File metadata
- Download URL: aioamqp-consumer-best-2.2.1.tar.gz
- Upload date:
- Size: 8.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c029e94bb87cfdec37311ffa5a0e94d336eb403b36e28386665989b814c31fff |
|
MD5 | d5dc57864ed30ef4c7bc5846d0553674 |
|
BLAKE2b-256 | e8ea5a0a8c894d510da06df14b2f7642c7ff513755c89b725c99fd20ff2a4fef |
Provenance
File details
Details for the file aioamqp_consumer_best-2.2.1-py2.py3-none-any.whl
.
File metadata
- Download URL: aioamqp_consumer_best-2.2.1-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.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 662594ab910c5b1d60fc4dcd54c358495fd81169f93cc8d13afc0ecbf81ab93e |
|
MD5 | 52a4d13a2d3b86577b7b519b34bb2335 |
|
BLAKE2b-256 | 93a903c1368f4e383e304ebda159b6713fefeb53d0054df9c6e8b307651fa7df |