No project description provided
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.1.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | dda6904c9f7ee4219f924027c166ec63850f71806bd5800378949acfb1cc5ba8 |
|
MD5 | c211dbdb62cab1c536a9af2a5ca65d45 |
|
BLAKE2b-256 | 58bd0f5595bc4e97dafb76cfd121e59231c37ef450f3b23fc2952086b931360a |
Close
Hashes for aioamqp_consumer_best-1.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a4b8ef7d544227041b42ffc0c49b0f1cb34c8cb16231a9f2e331ccca805f7e56 |
|
MD5 | 54de8cafea047668dbe0be52be17f1dd |
|
BLAKE2b-256 | 535510958c912fc2259da4a32c208b15dcb3daea5934bb558ded6fa94b7e91e4 |