Open SagiMedina opened 2 years ago
Adding async support for MQ client
On a simple test run, we got from 10K messages in ~50 minutes to 10K messages in under 1 min!
import asyncio from mq_http_sdk.mq_client import MQClient from mq_http_sdk.mq_producer import TopicMessage topic_name = "Async-POC" instance_id = "XXX" mq_client = MQClient(host="XXX", access_id="XXX", access_key="XXX") producer = mq_client.get_producer(instance_id, topic_name) async def multi_publish_message(): async with producer.async_session(): await producer.async_publish_message(TopicMessage("This is async 1", message_tag="async1.1")) await producer.async_publish_message(TopicMessage("This is async 2", message_tag="async1.2")) async def single_publish_message(): await producer.async_publish_message(TopicMessage("This is async 3", message_tag="async1.3")) asyncio.run(multi_publish_message()) asyncio.run(single_publish_message())
Adding async support for MQ client
On a simple test run, we got from 10K messages in ~50 minutes to 10K messages in under 1 min!