JmsOutboundGateway 重试连接 mq -> GatewayReplyListenerContainer refreshConnectionUntilSuccessful (maxAttempts=unlimited)

问题描述 投票:0回答:1

我对 JmsOutboundGateway 连接超时有疑问 (org.springframework.integration.jms.JmsOutboundGateway$GatewayReplyListenerContainerfreshConnectionUntilSuccessful) - 在我的例子中是 mq 连接。 当 mq 管理器关闭时,JmsOutboundGateway 会尝试连接 mq 一段时间,然后释放线程/请求。

我可以在 JmsOutboundGateway 中的哪里设置甚至检查此超时?它是从 ConnectionFactory 获取的吗?

为什么FixedBackOff的值是无限的,但是请求会超时。

错误日志:

org.springframework.integration.jms.JmsOutboundGateway$GatewayReplyListenerContainer refreshConnectionUntilSuccessful.1007] 
Could not refresh JMS Connection for destination - retrying using FixedBackOff{interval=5000, currentAttempts=4, maxAttempts=unlimited}. 
....reason '2538' ('MQRC_HOST_NOT_AVAILABLE').

完整错误日志:

org.springframework.integration.jms.JmsOutboundGateway$GatewayReplyListenerContainer handleListenerSetupFailure.940  ] - Setup of JMS message listener invoker failed for destination '' - trying to recover. Cause: null
org.springframework.integration.jms.JmsOutboundGateway$GatewayReplyListenerContainer refreshConnectionUntilSuccessful.1007  ] - Could not refresh JMS Connection for destination '' - retrying using FixedBackOff{interval=5000, currentAttempts=2, maxAttempts=unlimited}. Cause: JMSWMQ0018: Failed to connect to queue manager 'LOCAL' with connection mode 'Client' and host name 'localhost(1415)'.; nested exception is com.ibm.mq.MQException: JMSCMQ0001: WebSphere MQ call failed with compcode '2' ('MQCC_FAILED') reason '2538' ('MQRC_HOST_NOT_AVAILABLE').
org.springframework.integration.jms.JmsOutboundGateway$GatewayReplyListenerContainer refreshConnectionUntilSuccessful.1007  ] - Could not refresh JMS Connection for destination '' - retrying using FixedBackOff{interval=5000, currentAttempts=3, maxAttempts=unlimited}. Cause: JMSWMQ0018: Failed to connect to queue manager 'LOCAL' with connection mode 'Client' and host name 'localhost(1415)'.; nested exception is com.ibm.mq.MQException: JMSCMQ0001: WebSphere MQ call failed with compcode '2' ('MQCC_FAILED') reason '2538' ('MQRC_HOST_NOT_AVAILABLE').
org.springframework.integration.dispatcher.UnicastingDispatcher logExceptionBeforeFailOver.185  ] - An exception was thrown by 'bean 'jmsOutbound...Gateway'; defined in: 'class path resource [/endpoints/GatewayConfig.class]'; from source: '.endpoints....jmsOutbound...Gateway(org.springframework.jms.connection.CachingConnectionFactory,org.springframework.integration.jms.JmsOutboundGateway$ReplyContainerProperties)'' while handling 'GenericMessage [payload= dummy message, headers={Persistence=0, replyChannel=org.springframework.messaging.core.GenericMessagingTemplate$TemporaryReplyChannel@20e63967, Format=MQSTR   , errorChannel=org.springframework.messaging.core.GenericMessagingTemplate$TemporaryReplyChannel@20e63967, Priority=4, messageId=[B@4569ec95, id=016d2bb2-9b03-aad8-2dd1-13cb92e6c42e, uuid=bf90a819-5430-49f8-8dd3-a23eb87e515f, timestamp=1710398153261}]': failed to handle a message in the [bean 'jmsOutboundGateway'; defined in: 'class path resource [.../endpoints/GatewayConfig.class]'; from source: 'com....configuration.endpoints.GatewayConfig.jmsOutbound...Gateway(org.springframework.jms.connection.CachingConnectionFactory,org.springframework.integration.jms.JmsOutboundGateway$ReplyContainerProperties)']; nested exception is com.ibm.msg.client.jms.DetailedIllegalStateException: JMSWMQ0018: Failed to connect to queue manager 'LOCAL' with connection mode 'Client' and host name 'localhost(1415)'.
Check the queue manager is started and if running in client mode, check there is a listener running. Please see the linked exception for more information.. Failing over to the next subscriber.
spring spring-boot spring-integration
1个回答
1
投票

这是预期的行为。

BackOff
用于侦听器容器,但
JmsOutboundGateway
是由外部调用激活的,因此超时后失败是可以接受的。无限地阻止请求者是不行的。

您可以考虑为该网关申请一个

RequestHandlerRetryAdvice
,但同样:最好考虑一些逻辑来处理应用程序中那些丢失的连接,而不是尝试等待很长时间。

© www.soinside.com 2019 - 2024. All rights reserved.