【发布时间】:2020-01-27 09:21:29
【问题描述】:
我有 Apache Camel 路由,它调用 restlet 组件并使用来自异常处理程序的重新传递机制,该机制对更新我的数据库记录的每次失败执行一些处理,但如果我提供 2000 的重新传递延迟,则重试需要 24 秒之前的每一次尝试。下面是一段代码。让我知道为什么延迟比预期的要长。
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:cxf="http://camel.apache.org/schema/cxf"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd">
<!-- CXF Rest Endpoint Declaration -->
<cxf:rsServer address="http://localhost:9092/rest/corp"
id="FetchCDFRestRequest" serviceClass="com.tcl.Service.Service" />
<bean class="com.tcl.ExceptionOccurredRefProcessor" id="exProc" />
<bean class="org.apache.camel.builder.DeadLetterChannelBuilder"
id="DLCErrorHandler">
<property name="deadLetterUri"
value="activemq:queue:DMS.FAILURES.DLQ" />
<property name="redeliveryPolicy" ref="redeliveryPolicy" />
</bean>
<bean class="org.apache.camel.processor.RedeliveryPolicy"
id="redeliveryPolicy">
<property name="maximumRedeliveries"
value="3" />
<property name="maximumRedeliveryDelay" value="2000" />
<property name="retryAttemptedLogLevel" value="WARN" />
</bean>
<camelContext id="Corp"
xmlns="http://camel.apache.org/schema/spring">
<errorHandler id="eh" onExceptionOccurredRef="exProc">
<redeliveryPolicy id="redeliveryPolicy" />
</errorHandler>
<route errorHandlerRef="DLCErrorHandler"
id="MainRouteOppIDFolder" streamCache="true">
<from id="_CreateOppIDFolder"
uri="restlet:http://localhost:9092/rest/corp/createOppIDFolder?restletMethod=POST" />
----------
<to uri="restlet:http://localhost:9902/CreateOppIDFolder?restletMethod=POST" />
------------
<onException id="_onException1"
onExceptionOccurredRef="exProc"
redeliveryPolicyRef="redeliveryPolicy" useOriginalMessage="true">
<exception>java.lang.Exception</exception>
<handled>
<simple>true</simple>
</handled>
<log id="_log3" loggingLevel="INFO"
message="Handled ex >>>>> ${exception.message} " />
</onException>
</route>
</camelContext>
</beans>
以下是一些日志
14:47:52.701 [Restlet-1879974483] 警告 o.a.c.processor.DeadLetterChannel - ExchangeId 上的 (MessageId: ID-DESKTOP-P2DBOO5-1580115331236-0-19 上的传递失败: ID-DESKTOP-P2DBOO5-1580115331236-0-20 )。交付尝试:0 捕获:org.apache.camel.component.restlet.RestletOperationException:Restlet 操作调用http://localhost:9902/CreateOppIDFolder 失败,状态码:500 /n responseBody:org.apache.cxf.interceptor.Fault:无法发送消息。
14:48:15.044 [Camel (MyCamel) 线程 #15 - ErrorHandlerRedeliveryTask] 警告 o.a.c.processor.DeadLetterChannel - ExchangeId: ID-DESKTOP-P2DBOO5 上的 (MessageId: ID-DESKTOP-P2DBOO5-1580115331236-0-19 传递失败: ID-DESKTOP-P2DBOO5 -1580115331236-0-20)。交付尝试:1 捕获:org.apache.camel.component.restlet.RestletOperationException:Restlet 操作调用http://localhost:9902/CreateOppIDFolder 失败,状态代码:500 /n responseBody:org.apache.cxf.interceptor.Fault:无法发送消息。
14:48:37.252 [Camel (MyCamel) 线程 #17 - ErrorHandlerRedeliveryTask] 警告 o.a.c.processor.DeadLetterChannel - ExchangeId: ID-DESKTOP-P2DBOO5 上的 (MessageId: ID-DESKTOP-P2DBOO5-1580115331236-0-19 传递失败: ID-DESKTOP-P2DBOO5 -1580115331236-0-20)。交付尝试:2 捕获:org.apache.camel.component.restlet.RestletOperationException:Restlet 操作调用 http://localhost:9902/CreateOppIDFolder 失败,状态代码:500 /n responseBody:org.apache.cxf.interceptor.Fault:无法发送消息。
有什么建议吗?
【问题讨论】:
标签: apache-camel