Using RabbitMQ (Java client), is there a way to determine if network connection is closed during consume?

前端 未结 2 1763
囚心锁ツ
囚心锁ツ 2021-02-19 15:10

I\'m using RabbitMQ on RHEL 5.3 using the Java client. I have 2 nodes (machines). Node1 is consuming messages from a queue on Node2 using the Java helper class QueueingConsume

2条回答
  •  灰色年华
    2021-02-19 15:34

    In general, you're much better off posting questions regarding rabbitmq on the rabbitmq-discuss mailing list. We don't tend to track questions being asked outside of this.

    There is a heartbeat that you can configure, though it is off by default. You could also turn on TCP Keep Alive. Either call setRequestedHeartbeat on the ConnectionFactory before creating a new connection, or, subclass ConnectionFactory, override the configureSocket method, and call socket.setKeepAlive(true). Both should result in the connection noticing when the network dies.

提交回复
热议问题