基于rabbitmq的轻量级rpc调用封装
Project description
leaves
寓意为树叶,希望它是一个足够轻量且方便的rabbitmq rpc 调用
发布者使用
import asyncio
from leaves import RPC
async def main():
async with RPC(con_url="amqp://") as rpc:
rpc: RPC
data = await rpc.points.hello("test", a="345")
print(data)
print("结束")
asyncio.ensure_future(main())
asyncio.get_event_loop().run_forever()
消费者使用
from leaves import Leaf, Branch, MicroContainer
branch = Branch("points")
@branch.leaf(timeout=10)
async def hello(*args, **kwargs):
return 1
if __name__ == '__main__':
container = MicroContainer([branch], con_url=r"amqp://")
container.run()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
leaves-0.4.0.tar.gz
(4.8 kB
view details)
File details
Details for the file leaves-0.4.0.tar.gz.
File metadata
- Download URL: leaves-0.4.0.tar.gz
- Upload date:
- Size: 4.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.6.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
147a42553d9bd2be252d485346fe6969b4ac9d2542dda25235cd7a9b6b521b90
|
|
| MD5 |
94f45e967a8ebd93b560230554ffe937
|
|
| BLAKE2b-256 |
ea9388f86463305e985f1d75a7f1d143e152835ea8aa6b73085dc9a8751c971e
|