SimpleMessageListenerContainer 无法在 ems 代理故障转移时重新连接
SimpleMessageListenerContainer failed to reconnect on ems broker failover
我有 2 个 jms 侦听器应用程序,一个应用程序使用 DefaultMessageListenerContainer
,另一个应用程序使用 SimpleMessageListenerContainer
具有 DefaultMessageListenerContainer
的应用程序 能够 在 EMS 代理故障转移时重新连接,这是日志
Setup of JMS message listener invoker failed for destination 'SOME.TOPIC.T' - trying to recover. Cause: Connection is closed
Could not refresh JMS Connection for destination 'SOME.TOPIC.T' - retrying using FixedBackOff{interval=5000, currentAttempts=0, maxAttempts=unlimited}. Cause: Failed to connect to any server at: tcp://localhost:8285,tcp://localhost:8286
Could not refresh JMS Connection for destination 'SOME.TOPIC.T' - retrying using FixedBackOff{interval=5000, currentAttempts=1, maxAttempts=unlimited}. Cause: Failed to connect to any server at: tcp://localhost:8285,tcp://localhost:8286
具有 SimpleMessageListenerContainer
的应用程序 无法 在 EMS 代理故障转移时重新连接,这是日志
[TIBCO EMS TCPLink Reader (Server-109365)] INFO org.springframework.jms.listener.SimpleMessageListenerContainer - Trying to recover from JMS Connection exception: javax.jms.JMSException: Connection has been terminated
[TIBCO EMS TCPLink Reader (Server-109366)] ERROR org.springframework.jms.listener.SimpleMessageListenerContainer - Encountered non-recoverable JMSException
javax.jms.JMSException: Connection has been terminated
at com.tibco.tibjms.Tibjmsx.buildException(Tibjmsx.java:659) ~[tibjms-8.3.0.jar!/:?]
at com.tibco.tibjms.TibjmsConnection._invokeOnExceptionCallback(TibjmsConnection.java:2118) [tibjms-8.3.0.jar!/:?]
at com.tibco.tibjms.TibjmsConnection._onDisconnected(TibjmsConnection.java:2487) [tibjms-8.3.0.jar!/:?]
at com.tibco.tibjms.TibjmsConnection$ServerLinkEventHandler.onEventDisconnected(TibjmsConnection.java:367) [tibjms-8.3.0.jar!/:?]
at com.tibco.tibjms.TibjmsxLinkTcp$LinkReader.work(TibjmsxLinkTcp.java:328) [tibjms-8.3.0.jar!/:?]
at com.tibco.tibjms.TibjmsxLinkTcp$LinkReader.run(TibjmsxLinkTcp.java:259) [tibjms-8.3.0.jar!/:?]
两者都连接到同一个代理实例,如何使 SimpleMessageListenerContainer
侦听器在 JMS 异常时重新连接?
简单容器是……呃……简单。
它只尝试恢复连接一次。
默认容器更复杂并配置了 BackOff
(默认为每 5 秒无限次尝试)。
如果您需要这种复杂性,请使用默认容器,但它需要是事务性的以避免消息丢失的可能性 - 请参阅 javadoc。
我有 2 个 jms 侦听器应用程序,一个应用程序使用 DefaultMessageListenerContainer
,另一个应用程序使用 SimpleMessageListenerContainer
具有 DefaultMessageListenerContainer
的应用程序 能够 在 EMS 代理故障转移时重新连接,这是日志
Setup of JMS message listener invoker failed for destination 'SOME.TOPIC.T' - trying to recover. Cause: Connection is closed
Could not refresh JMS Connection for destination 'SOME.TOPIC.T' - retrying using FixedBackOff{interval=5000, currentAttempts=0, maxAttempts=unlimited}. Cause: Failed to connect to any server at: tcp://localhost:8285,tcp://localhost:8286
Could not refresh JMS Connection for destination 'SOME.TOPIC.T' - retrying using FixedBackOff{interval=5000, currentAttempts=1, maxAttempts=unlimited}. Cause: Failed to connect to any server at: tcp://localhost:8285,tcp://localhost:8286
具有 SimpleMessageListenerContainer
的应用程序 无法 在 EMS 代理故障转移时重新连接,这是日志
[TIBCO EMS TCPLink Reader (Server-109365)] INFO org.springframework.jms.listener.SimpleMessageListenerContainer - Trying to recover from JMS Connection exception: javax.jms.JMSException: Connection has been terminated
[TIBCO EMS TCPLink Reader (Server-109366)] ERROR org.springframework.jms.listener.SimpleMessageListenerContainer - Encountered non-recoverable JMSException
javax.jms.JMSException: Connection has been terminated
at com.tibco.tibjms.Tibjmsx.buildException(Tibjmsx.java:659) ~[tibjms-8.3.0.jar!/:?]
at com.tibco.tibjms.TibjmsConnection._invokeOnExceptionCallback(TibjmsConnection.java:2118) [tibjms-8.3.0.jar!/:?]
at com.tibco.tibjms.TibjmsConnection._onDisconnected(TibjmsConnection.java:2487) [tibjms-8.3.0.jar!/:?]
at com.tibco.tibjms.TibjmsConnection$ServerLinkEventHandler.onEventDisconnected(TibjmsConnection.java:367) [tibjms-8.3.0.jar!/:?]
at com.tibco.tibjms.TibjmsxLinkTcp$LinkReader.work(TibjmsxLinkTcp.java:328) [tibjms-8.3.0.jar!/:?]
at com.tibco.tibjms.TibjmsxLinkTcp$LinkReader.run(TibjmsxLinkTcp.java:259) [tibjms-8.3.0.jar!/:?]
两者都连接到同一个代理实例,如何使 SimpleMessageListenerContainer
侦听器在 JMS 异常时重新连接?
简单容器是……呃……简单。
它只尝试恢复连接一次。
默认容器更复杂并配置了 BackOff
(默认为每 5 秒无限次尝试)。
如果您需要这种复杂性,请使用默认容器,但它需要是事务性的以避免消息丢失的可能性 - 请参阅 javadoc。