Asyncamqp is a little extension to aioamqp based on the ideas from this pull request (https://github.com/Polyconseil/aioamqp/pull/118). The changes here get rid of the callbacks stuff.
Install
Install it using pip
$ pip install asyncamqp
Usage
To publish stuff, just do the same as you would do with aioamqp:
await channel.basic_publish(payload='hi there!', exchange_name='',
routing_key='my-rt')
To consume stuff, you don’t need to use callbacks anymore.
async with channel.basic_consume(queue_name='my-queue', exchange_name='',
routing_key='my-queue') as consumer:
async for msg in consumer:
print(msg.body)
Consuming messages this way we always wait for a new message to arrive in the queue. We can use a timeout in milliseconds for it, too:
# now we pass the timeout argument
async with channel.basic_consume(queue_name='my-queue', exchange_name='',
routing_key='my-queue',
timeout=100) as consumer:
async for msg in consumer:
print(msg.body)
Or we could simply consume the messages already in the queue and stop consuming stuff when we have no more messages:
# now we pass the wait_message argument.
async with channel.basic_consume(queue_name='my-queue', exchange_name='',
routing_key='my-queue',
wait_message=False) as consumer:
async for msg in consumer:
print(msg.body)
As it is a simple extension to aioamqp, please refer to the aioamqp’s docs for full information. Just remember that when consuming it you don’t use callbacks but the context manager/async for stuff.
Metadata
Release files for asyncamqp 0.1.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| asyncamqp-0.1.7.tar.gz | 17.3 kB | Without provenance | Details for asyncamqp-0.1.7.tar.gz |
Release files / asyncamqp-0.1.7.tar.gz
| Download URL | asyncamqp-0.1.7.tar.gz |
|---|---|
| Size | 17.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d70b25e53179351058d1aa125d1d4f9a9e7bde5dd5010bb0491c1320857ef974
|
|
BLAKE2b-256 checksum How to use checksums |
78ea67c627b9c6dc48f6a146e4ac7195f073456fc5e2cc1f8666ae2141ff483b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.2
|
Security for asyncamqp 0.1.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.