Spring AMQP v1.4.2 - Rabbit reconnection issue on network failure

前端 未结 3 1050
自闭症患者
自闭症患者 2021-01-08 01:10

I am testing the following scenario in Spring AMQP v1.4.2 and it fails to reconnect after a network disruption:

  1. Start the spring application which consumes mess
3条回答
  •  臣服心动
    2021-01-08 01:45

    I just ran your test as described (rabbit on linux using iptables to drop packets).

    There is no log when the connection is reestablished (perhaps we should).

    I suggest you turn on debug logging to see the reconnection.

    EDIT:

    From the rabbitmq documentation:

    exclusive Exclusive queues may only be accessed by the current connection, and are deleted when that connection closes. Passive declaration of an exclusive queue by other connections are not allowed.

    From your exception:

    reply-code=405, reply-text=RESOURCE_LOCKED - cannot obtain exclusive access to locked queue 'e4288669-2422-40e6-a2ee-b99542509273' in vhost '/', class-id=50, method-

    So the problem is the broker still thinks the other connection exists.

    1. Don't use an exclusive queue (you will lose messages with such a queue anyway). Or,
    2. Set a low requestedHeartbeat so the broker will detect the lost connection faster.

提交回复
热议问题