From 3b66db3ed7f3df992e397fcf42a23210a0a87539 Mon Sep 17 00:00:00 2001 From: NeonKirill Date: Sat, 16 Nov 2024 13:53:22 +0100 Subject: [PATCH] updated README.md with aio setup instructions --- README.md | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/README.md b/README.md index d0a01e7..1399455 100644 --- a/README.md +++ b/README.md @@ -66,3 +66,35 @@ A response may be sent via: ) ``` Where `` is the queue to which the response will be published, and `data` is a `bytes` response (generally a `base64`-encoded `dict`). + +### [BETA] Asynchronous Consumers + +Now there is a support for async-based consumers handling based on `aio-pika` API. + +#### Installation + +To install async dependencies, run installation with `[aio]` extra: +```shell +pip install neon-mq-connector[aio] +``` + +#### Enabling in a code + +When declaring the consumer/subscriber instances, specify `async_consumer` param like follows: +```python +register_consumer(name="some_consumer", + ... + async_consumer=True,) +register_subscriber(name="some_subscriber", + ... + async_consumer=True,) +``` + +To set creation of async consumers/subscribers globally, set the class-attribute `async_consumers_enabled` to True: + +```python +from neon_mq_connector import MQConnector + +class MQConnectorChild(MQConnector): + async_consumers_enabled = True +``` \ No newline at end of file