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.get_event_loop().run_until_complete(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
Close
Hashes for aioamqp-consumer-best-1.2.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 96907afc7738fd17cc2b4e7051c95d046a93e6dce39df46dfa152c3386b74fa9 |
|
MD5 | 5ba663628bb0900abd1b70684bf0aa1f |
|
BLAKE2b-256 | fae1fd90689dd7ed6216215282c3e6c453dd04627461d1961fcdef673bf8d7c7 |
Close
Hashes for aioamqp_consumer_best-1.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3d42cba478ae334f654c6bbe6246c54995821bed764c5a949a874d66cabcda56 |
|
MD5 | 3ac5b3e9c404ab63e38beb3f7f6b5c3f |
|
BLAKE2b-256 | 0b8cc82f2400b40bc4758de0f370b241eb16360e1f15b8fcebf44021df15435a |