CleverSwarm API invocation example

This commit is contained in:
Stanislav Hejny
2025-02-25 20:35:20 +00:00
parent 286a4986b3
commit eb26eec767
36 changed files with 1269 additions and 126 deletions
View File
+7 -1
View File
@@ -19,7 +19,13 @@ from amqp.service.tracing import initialize_trace
logging.basicConfig(level=logging.DEBUG)
logging.info(f"CWD = {os.getcwd()}")
logging.config.fileConfig('amqp/service/logging.conf')
logging_conf_path = os.path.join(os.getcwd(), 'amqp', 'service', 'logging.conf')
if os.path.exists(logging_conf_path):
logging.config.fileConfig(logging_conf_path)
else:
logging_conf_path = os.path.join(os.getcwd(), 'logging.conf')
if os.path.exists(logging_conf_path):
logging.config.fileConfig(logging_conf_path)
class AMQService:
CLEVER_AMQP_CLIENT_VERSION = os.getenv("CLEVER_AMQP_CLIENT_VERSION")
+3 -2
View File
@@ -82,7 +82,8 @@ class AMQServiceMessageHandler:
# map_as_string(amq_message.trace_info), context_with_span, context)
if amq_message.magic == AMQMessageFactory.MAGIC_BYTE_HTTP_REQUEST:
response: AMQResponse = self.http_adapter.on_message(amq_message)
response: AMQResponse = asyncio.run(self.http_adapter.on_message(amq_message))
self.send_reply(properties.reply_to, delivery_tag, channel, response)
else:
logging.error(" [E] Unknown MAGIC value: [%s], don't know how to interpret the message",
amq_message.magic)
@@ -137,7 +138,7 @@ class AMQServiceMessageHandler:
delivery_tag, reply_to, response.id)
reply_props = pika.BasicProperties(
correlation_id=response.id,
content_type=response.content_type
content_type=response.content_type[0]
)
channel.basic_publish(
exchange=AMQ_REPLY_TO_EXCHANGE,