1

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

Gajendra Kumar
  • 908
  • 2
  • 12
  • 28
  • Like I answered, in your previous question,why don't you just catch the error and send a trigger to stop the route. Camel will not then automatically send the message to DLQ. – Souciance Eqdam Rashti Jan 21 '18 at 23:52
  • How can i trigger to stop the route can you help with some piece of code. ThrottlingExceptionRoutePolicy is also doing the same stopping route for configured time. please see following https://github.com/apache/camel/blob/master/camel-core/src/main/java/org/apache/camel/impl/ThrottlingExceptionRoutePolicy.java – Gajendra Kumar Jan 22 '18 at 02:24
  • Catch the exception using try/catch or OnException() and then use the control bus component to stop the route. http://camel.apache.org/controlbus.html – Souciance Eqdam Rashti Jan 22 '18 at 08:31
  • I tried to use controlBus still current message is getting into DLQ and i can't restart route after specific time using controlBus. – Gajendra Kumar Jan 22 '18 at 09:42

0 Answers0