Skip to content

Commit

Permalink
updated README.md with aio setup instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
kirgrim committed Nov 16, 2024
1 parent eae5d6e commit 3b66db3
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,35 @@ A response may be sent via:
)
```
Where `<queue>` 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
```

0 comments on commit 3b66db3

Please sign in to comment.