Metadata-Version: 2.1
Name: aioamqp-consumer-best
Version: 2.2.0
Summary: Consumer utility for AMQP
Home-page: https://github.com/tkukushkin/aioamqp-consumer-best
Author: Timofey Kukushkin
Author-email: tima@kukushkin.me
License: MIT
Project-URL: Source, https://github.com/tkukushkin/aioamqp-consumer-best
Platform: UNKNOWN
Classifier: Development Status :: 4 - Beta
Classifier: Framework :: AsyncIO
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Python: ~=3.7
Description-Content-Type: text/markdown
Requires-Dist: aioamqp
Requires-Dist: anyio
Provides-Extra: test
Requires-Dist: aiodocker ; extra == 'test'
Requires-Dist: mypy ; extra == 'test'
Requires-Dist: pycodestyle ; extra == 'test'
Requires-Dist: pylint ; extra == 'test'
Requires-Dist: pytest ; extra == 'test'
Requires-Dist: pytest-asyncio ; extra == 'test'
Requires-Dist: pytest-cov ; extra == 'test'
Requires-Dist: pytest-mock ; extra == 'test'

# aioamqp-consumer-best

[![PyPI version](https://badge.fury.io/py/aioamqp-consumer-best.svg)](https://pypi.org/project/aioamqp-consumer-best/)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/aioamqp-consumer-best.svg?color=green)
[![Build Status](https://github.com/tkukushkin/aioamqp-consumer-best/workflows/build/badge.svg?branch=master)](https://github.com/tkukushkin/aioamqp-consumer-best/actions?query=workflow%3Abuild+branch%3Amaster)
[![codecov](https://codecov.io/gh/tkukushkin/aioamqp-consumer-best/branch/master/graph/badge.svg)](https://codecov.io/gh/tkukushkin/aioamqp-consumer-best)

## Usage

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


