changed mqtt to rabbitMQ test file

This commit is contained in:
2025-10-23 20:56:09 +03:00
parent 71621896eb
commit 5532e89038
3 changed files with 22 additions and 2 deletions

20
source/rabbitmq_test.py Normal file
View File

@@ -0,0 +1,20 @@
import pika
import ssl
print
context = ssl.create_default_context()
context.verify_mode = ssl.CERT_REQUIRED
ssl_options= pika.SSLOptions(context=context, server_hostname="rabbitmq.deowl.ru")
credential = pika.PlainCredentials("admin", "admin")
try:
connection = pika.BlockingConnection(pika.ConnectionParameters('rabbitmq.deowl.ru', virtual_host='/', port=5671, ssl_options=ssl_options, credentials=credential))
channel = connection.channel()
print("good")
except pika.exceptions.AMQPConnectionError as e:
print(f"Connection error: {e}")
except Exception as e:
print(f"An unexpected error occurred: {e}")