Using Circuit Breaker with camel -ThrottlingExceptionRoutePolicy

≯℡__Kan透↙ 提交于 2020-01-03 03:28:11

问题


There is a route which is consuming messages from a jms queue and after doing some processing sending a request to unreliable web service(Which can be down at times). So in case of service is down then i need to stop consuming from queue for some time. I tried to use ThrottlingExceptionRoutePolicy . It will stop route as per configuration but issue is for the current message which gets the error as message is getting moved to dead letter queue. I've gone through the code of ThrottlingExceptionRoutePolicy as per code this will be called after all error handling is done for route. So i need to modify default error handling of camel to avoid putting message to DLQ for some specific cases. I tried to configure various error handlers provided by camel but in all cases camel is putting messages to DLQ. Is there some configuration or i need to write custom error handler to achieve the same.

<camel:route id="someroute" routePolicyRef="throttlingExceptionRoutePolicy"
     errorHandlerRef="myTransactionErrorHandlerErrorHandler">
    <camel:from uri="activemq:inputQueue" />
    <camel:transacted />
    <camel:bean ref="afterQueueProcessor" />
    <camel:setHeader headerName="CamelHttpMethod">
        <camel:constant>POST</camel:constant>
    </camel:setHeader>
    <camel:setHeader headerName="Content-Type">
        <camel:constant>application/xyz</camel:constant>
    </camel:setHeader>

    <camel:to
        uri="http://localhost:8080/some-ws/newOrder?orderId=dd&amp;productName=bb&amp;quantity=1" />
</camel:route>

This questions is related to async communication

来源:https://stackoverflow.com/questions/48367905/using-circuit-breaker-with-camel-throttlingexceptionroutepolicy

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!