gpt4 book ai didi

jms - Azure 服务总线 : Amqp Idle Timeout condition = amqp:link:detach-forced

转载 作者:行者123 更新时间:2023-12-02 16:49:38 29 4
gpt4 key购买 nike

我得到的错误:

2019-12-09 06:39:33.189 ERROR 107132 --- [http-nio-8082-exec-5] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.jms.IllegalStateException: The MessageProducer was closed due to an unrecoverable error.; nested exception is javax.jms.IllegalStateException: The MessageProducer was closed due to an unrecoverable error.] with root cause

javax.jms.JMSException: Idle link tracker, link qpid-jms:sender:ID:7300953e-f587-4ae3-b9fe-85b84e032554:1:101:1:order-update has been idle for 1800000ms TrackingId:801ab247-3f36-4470-8665-08846eb1c181_G24, SystemTracker:client-link34404815, Timestamp:2019-12-06T21:04:35 [condition = amqp:link:detach-forced]
at org.apache.qpid.jms.provider.amqp.AmqpSupport.convertToException(AmqpSupport.java:164)
at org.apache.qpid.jms.provider.amqp.AmqpSupport.convertToException(AmqpSupport.java:117)
at org.apache.qpid.jms.provider.amqp.AmqpAbstractResource.processRemoteClose(AmqpAbstractResource.java:262)
at org.apache.qpid.jms.provider.amqp.AmqpProvider.processUpdates(AmqpProvider.java:906)
at org.apache.qpid.jms.provider.amqp.AmqpProvider.access$1800(AmqpProvider.java:102)
at org.apache.qpid.jms.provider.amqp.AmqpProvider$17.run(AmqpProvider.java:792)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:748)

依赖

compile group: 'com.microsoft.azure', name: 'azure-servicebus-spring-boot-starter', version: '0.2.0'
compile group: 'javax.jms', name: 'javax.jms-api', version: '2.0.1'
compile group: 'org.apache.qpid', name: 'qpid-jms-client', version: '0.28.0'
compile group: 'org.apache.camel', name: 'camel-jms', version: '2.24.1'
compile group: 'org.springframework.integration', name: 'spring-integration-jms', version: '5.0.4.RELEASE'

jmsConnectionFactory配置:

<bean id="jmsConnectionFactory" class="org.springframework.jms.connection.CachingConnectionFactory">
<property name="targetConnectionFactory">
<bean class="org.apache.qpid.jms.JmsConnectionFactory">
<constructor-arg value="${azure.jms.url}" />
<property name="username" value="${azure.jms.username}" />
<property name="password" value="${azure.jms.password}" />
<property name="clientID" value="AltaPay" />
<property name="receiveLocalOnly" value="true" />
<property name="localMessageExpiry" value="true" />
<property name="populateJMSXUserID" value="true" />
</bean>
</property>
<property name="exceptionListener">
<bean class="com.lauraashley.microservice.altapay.callback.exception.CustomJMSExceptionListener" />
</property>
<property name="sessionCacheSize" value="10" />
<property name="cacheConsumers" value="false" />
</bean>
<bean id="jmsConfig" class="org.apache.camel.component.jms.JmsConfiguration">
<property name="connectionFactory" ref="jmsConnectionFactory" />
<property name="cacheLevelName" value="CACHE_NONE" />
</bean>

CustomJMSExceptionListener

public class CustomJMSExceptionListener implements ExceptionListener {

private static final Logger logger = getLogger(CustomJMSExceptionListener.class);

@Override
public void onException(JMSException exception) {
// TODO Auto-generated method stub
logger.error("--------------- Catched exception with CustomJMSExceptionListener ---------------");
logger.error("Error code:"+exception.getErrorCode());
logger.error("Msg:"+exception.getMessage());
exception.printStackTrace();
logger.error("---------------------------------------------------------------------------------");
}
}

我如何复制它

首先:CustomJMSExceptionListener 没有被使用,是不是没有配置好?

该应用程序是 OCC(oracle 云商务)平台上的电子商务应用程序,使用 java spring-boot 服务进行支付集成和流程。

当订单超过空闲时间然后与 Azure 服务总线的连接失败并且为了重新连接我必须重新启动 java 应用程序时会发生此错误,这是一个相当大的问题,因为无法处理更多的订单。我读到 CachingConnectionFactory 有 reconnectOnException,默认情况下为 true。

我真的不明白为什么会发生这种情况以及解决它的解决方案。

最佳答案

异常表明 Azure 已关闭生产者,因为它闲置了很长时间,这意味着它没有在超时内发送消息(一些文档 here )。在使用 CachingConnectionFactory 时,您可以通过配置 cache producers option 来解决这个问题为 false 以便按需创建生产者,但我对此并不完全确定,因为我没有任何方法来测试它。

这不是 Qpid JMS 客户端级别的错误,而是 Azure 的行为,在我认为链接上没有任何事件十分钟后,它会强行关闭链接。在非基于 spring 的应用程序中,您必须通过在发送时捕获 JMSException 来解决这个问题,要么尝试创建新的生产者并再次发送,要么断开整个连接并重新开始。你的 react 在某种程度上取决于你是否预知你正在使用 Azure 并且知道这可能会发生。

关于jms - Azure 服务总线 : Amqp Idle Timeout condition = amqp:link:detach-forced,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59248234/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com