aioamqp-consumer-best 2.4.0

Creator: bradpython12

Last updated:

0 purchases

aioamqp-consumer-best 2.4.0 Image
aioamqp-consumer-best 2.4.0 Images

Languages

Categories

Add to Cart

Description:

aioamqpconsumerbest 2.4.0

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())

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Customer Reviews

There are no reviews.