Apache Camel - Delay when exception occurs -
i have written camel route polls file folder, picks request, checks memory consumption on server (in java file). if below threshold drops request on jms queue otherwise throws exception , picks again processing.
what need when exception thrown need delay processing configurable amount of time 15 mins. give time server stabilize instead of keeping polling unnecessarily. using errorhandler mechanism of camel doesnt seem work. camle keeps on picking request without delay. please issue. below bundle context snapshot:
<camel:onexception> <camel:exception>java.lang.exception</camel:exception> <camel:redeliverypolicy backoffmultiplier="500" /> <camel:log message="default error handler called"></camel:log> </camel:onexception> <camel:route> <!-- reading rest url --> <camel:from uri="<my url>" /> <!-- if else loop --> <camel:choice> <camel:when> <camel:xpath>some path</camel:xpath> <!-- parsing ordernumber , orderversion--> <camel:log message="recieved request ${headers.ordernumber}-${headers.orderversion}.xml"/> <camel:setheader headername="ordernumber"> <xpath>some path</xpath> </camel:setheader> <camel:setheader headername="orderversion"> <camel:xpath>some path</camel:xpath> </camel:setheader> <!-- request being put in file folder --> <to uri="file:data/inbox?filename=${header.ordernumber}-${header.orderversion}.xml" pattern="inout" /> </camel:when> <!-- other requests put on queue --> <camel:otherwise> <camel:log message="request ${headers.ordernumber}-${headers.orderversion}.xml directly sent queue"/> <to uri="my queue" pattern="inout" /> </camel:otherwise> </camel:choice> </camel:route> <camel:route errorhandlerref="errorhandler"> <!-- route put message folder jms queue if memory consumption below limit--> <camel:from uri="file:data/inbox"/> <camel:process ref="checkmemoryconsumption"/> <camel:convertbodyto type="string" /> <camel:log message="sucessfully processing service order ${headers.ordernumber}-${headers.orderversion}.xml"/> <to uri="my queue" pattern="inout" /> </camel:route>
did try redeliverydelay of redeliverypolicyprofile?
below policy profile retry 3 times delay of 1000ms between each try.
<redeliverypolicyprofile id="myredeliveryprofile" maximumredeliveries="3" redeliverydelay="1000" allowredeliverywhilestopping="false" retryattemptedloglevel="info" /> read more on here
Comments
Post a Comment