Replies: 3 comments
-
Maybe use the HTTP API for send message, it's simple and thread safe. Doc: https://www.cloudamqp.com/docs/http.html code sample: https://github.com/Yodo1Games/eva-core/blob/dev/core/tools/rabbit.py async def publish(cls, host: str, user: str, password: str, virtualhost: str, exchange: str, data: Dict, retry: int = 3) -> Tuple[bool, str]:
target_url = 'https://' + host + '/api/exchanges/' + quote_plus(virtualhost) + '/' + exchange + '/publish'
target_params = {
'properties': {},
'routing_key': '',
'payload_encoding': 'string',
'payload': json.dumps(data)
}
async with aiohttp.ClientSession(timeout=aiohttp.ClientTimeout(total=30), auth=aiohttp.BasicAuth(user, password)) as session:
try: |
Beta Was this translation helpful? Give feedback.
0 replies
-
I have two points.
@app.on_event('startup')
async def startup(app):
loop = asyncio.get_running_loop()
app.request.mq_client = create_client(xxxxx) Two reference: |
Beta Was this translation helpful? Give feedback.
0 replies
-
@vietor @Dustyposa Please review #9, implemented HTTP sender. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi all, we have been run into RabbitMQ Async client issue. So we had to roll back to the RabbitMQ sync sender with pika.
But we need to discuss how to use the pika. Here are several way to use it.
Personally I prefer the solution 2. Let's discuss which one is more suitable for our use case.
Deadline: 2022-01-11.
Beta Was this translation helpful? Give feedback.
All reactions