Merge pull request '#28 - stop using Thread as CleverSwarm methods are not thread-safe' (#37) from single-thread into develop
Unit test coverage / pytest (push) Failing after 1m16s
CI for pypl publish / publish-lib (push) Successful in 1m20s

Reviewed-on: #37
This commit was merged in pull request #37.
This commit is contained in:
2025-05-02 09:08:11 +00:00
committed by Forgejo
3 changed files with 14 additions and 5 deletions
+12 -3
View File
@@ -75,12 +75,21 @@ class DataMessageHandler:
self.file_handler: FileHandler = file_handler
self.backpressure_handler: BackpressureHandler = backpressure_handler
async def inbound_data_message_callback(self, message: AbstractIncomingMessage):
async def inbound_data_message_callback_as_thread(
self, message: AbstractIncomingMessage
):
"""
The callback method that is called when a DataMessage is received from RabbitMQ, starts new Thread.
"""
threading.Thread(
target=lambda: asyncio.run(self.run_callback_thread(message))
target=lambda: asyncio.run(
self.inbound_data_message_callback_no_thread(message)
)
).start()
async def run_callback_thread(self, message: AbstractIncomingMessage):
async def inbound_data_message_callback_no_thread(
self, message: AbstractIncomingMessage
):
"""
Receives the DataMessage as bytes from RabbitMQ queue and deserializes it to the DataMessage object
Ensures Jaeger trace-id propagation.
+1 -1
View File
@@ -107,7 +107,7 @@ class AMQService:
try:
await self.rabbit_mq_client.register_inbound_routes(
route_mapping,
self.amq_data_message_handler.inbound_data_message_callback,
self.amq_data_message_handler.inbound_data_message_callback_no_thread,
)
return await self.rabbit_mq_client.register_data_reply_callback(
self.amq_data_message_handler.reply_received_callback
+1 -1
View File
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "amq_adapter"
version = "0.2.25"
version = "0.2.26"
description = "The Python implementation of the AMQ Adapter for CleverMicro"
readme = "README.md"
authors = [