Подключение от stomp.py к ActiveMQ Artemis периодически завершается сбоемPython

Программы на Python
Anonymous
Подключение от stomp.py к ActiveMQ Artemis периодически завершается сбоем

Сообщение Anonymous »

Я использую протокол Stomp для проверки состояния работоспособности ActiveMQ Artemis 2.32.0. Итак, у меня есть 5 брокеров, которым я отправляю сообщение и использую его. Я вижу некоторые ошибки, но периодически для разных брокеров. Каковы возможные причины?

Код: Выделить всё

def send_message(cluster, host, password, retries_left=3):
if retries_left == 0:
logger.error(f"Failed to connect to {cluster} after all retries.")
return 0

try:
conn = stomp.Connection([(host,61616)])
conn.set_listener('', Listener())
conn.set_ssl(for_hosts=[(host,61616)], ssl_version=ssl.PROTOCOL_TLS)
conn.connect('artemis', password, wait=True)
conn.subscribe(destination='HealthCheck::HealthCheck', id=1, ack='auto')
conn.send(body="Health Check Message", destination='HealthCheck::HealthCheck')
time.sleep(2)
conn.disconnect()
return 1
except Exception as e:
logger.exception(f"Exception occurred for cluster {cluster}")
backoff_time = 4 - retries_left
logger.info(f"Retrying in {backoff_time} seconds...")
time.sleep(backoff_time)
return send_message(cluster, host, password, retries_left - 1)
Приемник выглядит так -

Код: Выделить всё

tcp://0.0.0.0:61616?tcpSendBufferSize=1048576;tcpReceiveBufferSize=1048576;amqpMinLargeMessageSize=102400;protocols=CORE,AMQP,STOMP,HORNETQ,MQTT,OPENWIRE;useEpoll=true;amqpCredits=1000;amqpLowCredits=300;amqpDuplicateDetection=true;supportAdvisory=false;suppressInternalManagementObjects=false;sslEnabled=true;sslAutoReload=true;keyStorePath=/var/lib/artemis/security/certificate/keystore.jks;keyStorePassword=ENC(-e9049c7885c621524f7c857604318db)
Ошибка –

Код: Выделить всё

2024-04-14 04:01:04 [ERROR]: Exception occurred for cluster dq1104
Traceback (most recent call last):
File "/app/healthCheck.py", line 75, in send_message
conn.connect('artemis', password, wait=True)
File "/usr/local/lib/python3.9/site-packages/stomp/connect.py", line 151, in connect
Protocol11.connect(self, *args, **kwargs)
File "/usr/local/lib/python3.9/site-packages/stomp/protocol.py", line 339, in connect
self.transport.wait_for_connection()
File "/usr/local/lib/python3.9/site-packages/stomp/transport.py", line 318, in wait_for_connection
raise exception.ConnectFailedException()
stomp.exception.ConnectFailedException
Получение этого на сервере ActiveMQ

Код: Выделить всё

2024-04-14 06:06:04,795 ERROR [org.apache.activemq.artemis.core.server] AMQ224088: Timeout (10 seconds) on acceptor "artemis" during protocol handshake with /10.1.1.126:56178 has occurred.
Весь код можно найти здесь

Подробнее здесь: https://stackoverflow.com/questions/783 ... rmittently

Вернуться в «Python»