使用ActiveMQ,为了测试拔掉了网线,就出来如下异常
- Transport Connection to: tcp://211.69.207.52:11334 failed: java.net.SocketException: Connection reset
- Transport Connection to: tcp://211.69.207.52:11335 failed: java.net.SocketException: Connection reset
- Transport Connection to: tcp://211.69.207.52:11333 failed: java.net.SocketException: Connection reset
- Transport (tcp://211.69.207.52:61616) failed, reason: java.net.SocketException: Connection reset, attempting to automatically reconnect
- Transport (tcp://211.69.207.52:61616) failed, reason: java.net.SocketException: Connection reset, attempting to automatically reconnect
- Transport (tcp://211.69.207.52:61616) failed, reason: java.net.SocketException: Connection reset, attempting to automatically reconnect
此后程序就堵塞在producer.send(msg); 这里
当连上网线后,提示
- Successfully reconnected to tcp://211.69.207.52:61616
- Successfully reconnected to tcp://211.69.207.52:61616
此后程序才能继续跑下去
想让能在网线拔掉的状态下,生产者能继续发消息 不知道这个异常是怎么产生的
------解决方案--------------------
你应该设置持久化订阅了吧。有没有这句设置setDeliveryMode(DeliveryMode.PERSISTENT);