rabbitmq临时队列上的Python服务到服务通信
py-s2s的Python项目详细描述
Py S2S系统
这是通过RabbitMQ发布和订阅响应的简单过程。这只是用于服务到服务通信的“httpoverrabbit”所需两个部分的一半。在
通知
这是一个使用aio pika的异步库。在
示例
asyncdefrun():conn=RabbitConfig(host='localhost',port=5672,username='guest',password='guest',exchange='/',queue_name='my_queue'# This is a prefix, it will append a random string to the end of this.)c=Service2Service(service_name='Test Service',config=conn)headers={'authorization':'Bearer XX','content-type':'application/json'}r=awaitc.request('accounts.load',dict(test=True,name='bob'),headers=headers)print(r)# Returns a `S2S GenericResponse` dataclass
- 项目
标签: