feat/#63 - cleverswarm unidirectional command
This commit is contained in:
@@ -5,14 +5,14 @@
|
||||
# CleverMicro AMQ Adapter settings that identify this AMQ Adapter instance to other adapters
|
||||
|
||||
# A name to identify this service for the AMQ Adapter
|
||||
cm.amq-adapter.service-name=cleverswarm
|
||||
cm.amq-adapter.service-name=otdemo
|
||||
# The CleverMicro AMQ Adapter instance ID, used to identify this instance in the CleverMicro AMQ Adapter cluster
|
||||
cm.amq-adapter.generator-id=1
|
||||
# Route mapping. For route detail description see section 3.1 in Onboarding Guide for Python:
|
||||
# https://docs.cleverthis.com/en/architecture/microservices/onboarding/python
|
||||
# NOTE: this is a comma-separated list of route mappings (multiple, comma-separated routes are allowed here)
|
||||
# cm-dev route
|
||||
cm.amq-adapter.route-mapping=otdemo:otdemo-exchange:otdemo-queue:api.cm.dev.cleverthis.com.test.python.#:5:0
|
||||
cm.amq-adapter.route-mapping=otdemo:otdemo-exchange:otdemo-queue-1:api.cm.dev.cleverthis.localhost.test.python.frontend.#:5:0,otdemo-2:otdemo-exchange:otdemo-queue-2:otdemo-2.#:5:0
|
||||
# local route
|
||||
#cm.amq-adapter.route-mapping=otdemo::otdemo:api.dev.localhost.otdemo.#:5:0
|
||||
# Indicate if AMQ Adapter should respond with HTTP 401 Unauthorized if the request does not contain valid JWT token
|
||||
@@ -20,7 +20,7 @@ cm.amq-adapter.require-authenticated-user=false
|
||||
|
||||
# CleverMicro AMQ Adapter dispatcher, settings related to RabbitMQ connection and optional REST forwarding
|
||||
cm.dispatch.use-dlq=true
|
||||
cm.dispatch.amq-host=rabbitmq
|
||||
cm.dispatch.amq-host=localhost
|
||||
cm.dispatch.amq-port=5672
|
||||
cm.dispatch.amq-port-tls=5671
|
||||
cm.dispatch.download-dir=/tmp/downloaded_files
|
||||
@@ -37,7 +37,7 @@ cm.backpressure.threshold-cpu-overload=90
|
||||
# Define maximum CPU usage (%) before triggering backpressure IDLE alert
|
||||
cm.backpressure.threshold-cpu-idle=10
|
||||
# Define the time window between the Backpressure reports, in seconds
|
||||
cm.backpressure.time-window=10
|
||||
cm.backpressure.time-window=15
|
||||
# Define the time window length, in seconds, during which, if CPU usage is consistently above the threshold, the system will trigger OVERLOAD alert
|
||||
cm.backpressure.cpu-overload-duration=30
|
||||
# Define the time window length, in seconds, during which, if no request is made to the Service, the system will trigger IDLE alert
|
||||
|
||||
@@ -32,8 +32,8 @@ class OTDemoAmqpAdapter(CleverThisServiceAdapter):
|
||||
|
||||
def __init__(self, amq_configuration: AMQConfiguration, routes: List[APIRoute]):
|
||||
super().__init__(amq_configuration, routes=routes, session=None)
|
||||
_amq_service: AMQService = AMQService(amq_configuration, self)
|
||||
self.thread = Thread(target=_amq_service.run)
|
||||
self.amq_service: AMQService = AMQService(amq_configuration, self)
|
||||
self.thread = Thread(target=self.amq_service.run)
|
||||
self.thread.start()
|
||||
|
||||
async def get_current_user(self, token: str) -> str:
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
def print_document_id_static(document_id: str) -> str:
|
||||
print(f"STATIC Document ID: {document_id}")
|
||||
return "STATIC PRINTED!"
|
||||
|
||||
|
||||
class Backend:
|
||||
|
||||
def __init__(self, name: str, description: str):
|
||||
self.name = name
|
||||
self.description = description
|
||||
|
||||
def __repr__(self):
|
||||
return f"Backend(name={self.name}, description={self.description})"
|
||||
|
||||
def __str__(self):
|
||||
return f"{self.name}: {self.description}"
|
||||
|
||||
def __eq__(self, other):
|
||||
if not isinstance(other, Backend):
|
||||
return False
|
||||
return self.name == other.name and self.description == other.description
|
||||
|
||||
def print_document_id(self, document_id: str) -> str:
|
||||
print(f"CLASS Document ID: {document_id}")
|
||||
return "CLASS PRINTED!"
|
||||
Reference in New Issue
Block a user