Tiktok-Talent-Info/connect_rabbitmq.py

11 lines
269 B
Python
Raw Permalink Normal View History

2025-03-22 20:54:10 +08:00
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}")