当前位置: 首页 > 知识库问答 >
问题:

Apache Camel OnExceptionAcception组件没有按照重新交付延迟重新交付

西门奇希
2023-03-14
<?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>

有什么建议吗?

共有1个答案

益清野
2023-03-14

您确定重试需要24秒吗?

难道重试失败(重试结束)不需要大约24秒吗?

所有三条日志语句都报告来自目标endpoint的错误500。是否可能重试在2秒后开始,进行HTTP调用,但又需要20秒,直到endpoint回答错误500?

00:00 error occurs
00:02 Camel triggers retry after 2 seconds
00:02 HTTP call to http://localhost:9902...
00:xx Waiting for reponse from http://localhost:9902
00:2x Log output after 20-something seconds that retry is failed
 类似资料:
  • 设置: 我们有一个Spring Boot应用程序,它正在从ActiveMQ Artemis JMS队列读取消息 这些消息正在JPA事务中处理 当在JPA中有一个异常触发回滚时,它也会在Artemis中触发一个JMS回滚,而Artemis设置了重新交付延迟 我们的应用程序在多个实例中并行运行,这在处理共享公共数据的多条消息时会导致乐观锁定问题 问题:当X消息被并行处理并且存在乐观锁定问题时,只有一个

  • 我有一个带有。RecipientList()的动态终结点,我希望在发生异常时更改终结点。下面是我的例子:

  • 我正在使用: SpringBoot 2.0.4 ActiveMQ 5.15.5 Apache Camel 2.22.0 Java1.8 太棒了 马文 基本上,我有一个带有Apache Camel路由的SpringBoot应用程序,它使用来自ActiveMQ的消息和事务。我需要在ActiveMQ上设置一个Re的策略,所以当处理中发生错误时,消息会被重试多次。 我已经用bean为ActiveMQ创建了

  • 我试图让Camel使用退避重发策略重试一个msg到JMS(实际上是MQ over JMS)。以下是我得到的: 我对这里应该发生的事情的理解是,初始超时将是1000ms。之后,骆驼将等待2000ms,然后4000ms,等等,直到我们到达30000ms。 正在发生的是,消息被重试,但每次重试1000ms。 我可能需要在上面的代码中更改什么才能得到我要寻找的结果? TIA

  • 谁能解释一下ActiveMQ重新交付策略实际上是如何工作的?它是在客户端还是在服务器端工作? 假设我有一个重新传递策略,每次尝试之间间隔30分钟,重新传递消息长达10分钟,那么失败的消息到底在哪里? 假设消息现在失败了,30分钟后重新发送,那么消息在哪里? http://activemq.apache.org/redelivery-policy.html http://activemq.apach

  • 我在我的WordPress网站上使用JetPack,并启用了延迟加载。然而,在我的网站中,我用AJAX更新了一些内容,这导致加载1x1占位符的图像,而不是真正的图像,这是懒惰加载会处理的。 如何使用Jet Pack再次调用延迟加载?我似乎记得有一个JavaScript函数,但找不到它是什么。