jms连接失败后Spring Boot应用无法恢复

Springboot application unable to recover after jms connection failure

我们有一个 sprinboot 应用程序,它在 3 次连接尝试后停止重试连接安慰队列。我们记录了以下信息,然后应用程序没有响应,我们必须重新启动应用程序:

2021-09-15 16:49:08.021  INFO 4444 --- [recovery-thread] bitronix.tm.recovery.Recoverer           : recoverer is already running, abandoning this recovery request
2021-09-15 16:50:04.862  INFO 4444 --- [connect_service] c.s.j.protocol.impl.TcpClientChannel     : Connection attempt failed to host '<<hostname>>' ReconnectException com.solacesystems.jcsmp.JCSMPSecurityException: Error performing login to LoginContext (*****) cause: javax.security.auth.login.LoginException: *****
2021-09-15 16:50:07.865  INFO 4444 --- [connect_service] c.s.j.protocol.impl.TcpClientChannel     : Connecting to host 'orig=tcp://<<hostname>>:55555, scheme=tcp://, host=<<hostname>>, port=55555' (host 1 of 1, smfclient 2, attempt 3 of 3, this_host_attempt: 1 of 1)
2021-09-15 16:50:07.877  INFO 4444 --- [connect_service] c.s.j.protocol.impl.TcpClientChannel     : Connection attempt failed to host '<<hostname>>' ReconnectException com.solacesystems.jcsmp.JCSMPSecurityException: Error performing login to LoginContext (*****) cause: javax.security.auth.login.LoginException: *****
2021-09-15 16:50:10.878  INFO 4444 --- [connect_service] c.s.j.protocol.impl.TcpClientChannel     : Stale reconnect task, aborting reconnect.

以下是我们连接到安慰队列的配置:

spring.jta.bitronix.connectionfactory.className=com.solacesystems.jms.SolXAConnectionFactoryImpl
spring.jta.bitronix.connectionfactory.driverProperties.host=smf://<<hostname>>:55555
spring.jta.bitronix.connectionfactory.driverProperties.VPN=<<vpn>>
spring.jta.bitronix.connectionfactory.driverProperties.authenticationScheme=AUTHENTICATION_SCHEME_GSS_KRB
spring.jta.bitronix.connectionfactory.driverProperties.KRBServiceName=HOST

在我们的服务 class 中,我们只是自动装配 jmsTemplate 对象并在队列中发布消息。

我浏览了一些文档并尝试添加以下配置:

spring.jta.bitronix.connectionfactory.ignore-recovery-failures=true

但我仍然面临同样的问题。有什么建议

====编辑

只有当我将笔记本电脑设置为飞行模式并重新连接时,我才会遇到这个问题。如果我只是断开与 VPN 的连接并重新连接,安慰连接正在重新建立

SolXAConnectionFactory 界面允许您调整连接和重新连接参数。文档 here.

您会想检查这些,也许还有其他一些。我建议在 javadoc 中搜索“retry”和“retries”:

  • 连接重试次数
  • connectRetriesPerHost
  • connectTimeoutInMillies
  • 重新连接重试

我做了更多研究,发现以下内容很有帮助,会在我的应用程序中尝试:https://solace.community/discussion/917/why-won-t-my-solace-enterprise-application-reconnect-after-an-ha-failover 要在 JNDI 中设置它,我认为这也应该在 SolAdmin -> JMS 管理 -> 连接工厂中进行配置-> 传输属性。

在浏览了各种文档并进行了一些点击和试验后,发现以下属性也很有用。希望它可以帮助某人:

spring.jta.bitronix.connectionfactory.driverProperties.reconnectRetries = -1
spring.jta.bitronix.connectionfactory.driverProperties.connectRetries = -1