Tiktok-Talent-Info/connect_rabbitmq.py

11 lines
269 B
Python

from kombu import Connection
rabbitmq_url = "amqp://guest:guest@localhost//"
with Connection(rabbitmq_url) as conn:
try:
conn.connect()
print("RabbitMQ connection successful!")
except Exception as e:
print(f"Failed to connect: {e}")