Pika blocking_connection.py random timeout connecting to RabbitMQ

后端 未结 2 1741
长情又很酷
长情又很酷 2021-01-13 01:34

i have a rabbit mq running on machine

  • both client and rabbitMQ are running on the same network
  • rabbitMQ has many clients
  • i can ping client f
相关标签:
2条回答
  • 2021-01-13 02:11

    Pika provides some time out issue when connecting different hosts.Solution is to pass a socket_timeout argument in connection parameter.Pika should upgrade to >=0.9.14

    credentials = pika.PlainCredentials(RABBITMQ_USER, RABBITMQ_PASS)
    connection = pika.BlockingConnection(pika.ConnectionParameters(
        credentials=credentials,
            host=RABBITMQ_HOST,
             socket_timeout=300))
    channel = connection.channel()
    
    0 讨论(0)
  • 2021-01-13 02:25

    I had a similar issue. If everything looks fine, then you most likely have some sort of miss configuration, e.g. bad binding. If miss configured, then you'll get a timeout because the script can't reach where it thinks it needs to go, so the error can be miss leading in this case.

    For my problem, I specifically had issues with both my rabbitmq.config file and my bindings and had to use my python solution shown in: RabbitMQ creating queues and bindings from a command line over the command line example I showed. Once updated and configured properly, everything worked fine. Hopefully this gets you in the right direction.

    0 讨论(0)
提交回复
热议问题