PATIO Rabbitmq
PATIO is an acronym for Python Asynchronous Task for AsyncIO.
This package provides RabbitMQ broker implementation.
Example
Task executor
import asyncio
import operator
from functools import reduce
from patio import Registry, ThreadPoolExecutor
from patio_rabbitmq import RabbitMQBroker
rpc = Registry(project="patio-rabbitmq", auto_naming=False)
@rpc("mul")
def mul(*args):
return reduce(operator.mul, args)
async def main():
async with ThreadPoolExecutor(rpc, max_workers=16) as executor:
async with RabbitMQBroker(
executor, amqp_url="amqp://guest:guest@localhost/",
) as broker:
await broker.join()
if __name__ == "__main__":
asyncio.run(main())
Task producer
import asyncio
from patio import NullExecutor, Registry
from patio_rabbitmq import RabbitMQBroker
async def main():
async with NullExecutor(Registry(project="patio-rabbitmq")) as executor:
async with RabbitMQBroker(
executor, amqp_url="amqp://guest:guest@localhost/",
) as broker:
print(
await asyncio.gather(
*[
broker.call("mul", i, i, timeout=1) for i in range(10)
]
),
)
if __name__ == "__main__":
asyncio.run(main())
Metadata
Release files for patio-rabbitmq 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| patio_rabbitmq-0.1.1.tar.gz | 2.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| patio_rabbitmq-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 6.5 kB
Release files / patio_rabbitmq-0.1.1.tar.gz
| Download URL | patio_rabbitmq-0.1.1.tar.gz |
|---|---|
| Size | 2.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
61d1c13f3875f0be226923c41ef12f6b5a8725c0294aba7319e4cb1015e75859
|
|
BLAKE2b-256 checksum How to use checksums |
af092152cb4bc2d9f2181d0f745211ad2b56e07e599da82e59bb0efc43c140eb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.4.0 CPython/3.10.2 Darwin/22.4.0
|
Release files / patio_rabbitmq-0.1.1-py3-none-any.whl
| Download URL | patio_rabbitmq-0.1.1-py3-none-any.whl |
|---|---|
| Size | 3.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0e9172704adb921fe3167d6fe3fb46f00af59637e38d66c95deca033a7b2fa34
|
|
BLAKE2b-256 checksum How to use checksums |
49076c77b0492556eb6f63b3f72adee5279d69d43f8226b64262952dbc3d7c10
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.4.0 CPython/3.10.2 Darwin/22.4.0
|