title: Apache Camel - Delay when exception occurs
body: <p>I have written a camel route that polls a file folder, picks up request, checks for memory consumption on server (in a java file). If its below threshold it drops the request on a JMS queue otherwise it throws an exception and picks it again for processing.</p>
  
  <p>What i need to do is that when exception is thrown i need to delay processing for a configurable amount of time say 15 mins. This will give some time for server to stabilize instead of keeping it polling unnecessarily.
  I am using errorHandler mechanism of camel however it doesnt seem to work. Camle keeps on picking up the request without any delay. Please help with this issue.
  Below is the bundle context snapshot:</p>
  
  <pre><code>&lt;camel:onException&gt;
          &lt;camel:exception&gt;java.lang.Exception&lt;/camel:exception&gt;
          &lt;camel:redeliveryPolicy backOffMultiplier="500" /&gt;
          &lt;camel:log message="Default error handler was called"&gt;&lt;/camel:log&gt;
      &lt;/camel:onException&gt;
              &lt;camel:route&gt;
                  &lt;!--  Reading from REST url --&gt;
                  &lt;camel:from uri="&lt;my url&gt;" /&gt;
                  &lt;!--  If else loop --&gt;
                  &lt;camel:choice&gt;
                      &lt;camel:when&gt;
                          &lt;camel:xpath&gt;Some path&lt;/camel:xpath&gt;
                          &lt;!--  Parsing OrderNumber and OrderVersion--&gt;
                          &lt;camel:log message="Recieved request ${headers.OrderNumber}-${headers.OrderVersion}.xml"/&gt;
                          &lt;camel:setHeader headerName="OrderNumber"&gt;
                              &lt;xpath&gt;Some path&lt;/xpath&gt;
                          &lt;/camel:setHeader&gt;
                          &lt;camel:setHeader headerName="OrderVersion"&gt;
                              &lt;camel:xpath&gt;Some path&lt;/camel:xpath&gt;
                          &lt;/camel:setHeader&gt;
                          &lt;!-- Request being put in file folder --&gt;
                          &lt;to
                              uri="file:data/inbox?fileName=${header.OrderNumber}-${header.OrderVersion}.xml"
                              pattern="InOut" /&gt;
                      &lt;/camel:when&gt;
                      &lt;!--  For all other requests put on  queue --&gt;
                      &lt;camel:otherwise&gt;
                          &lt;camel:log message="Request ${headers.OrderNumber}-${headers.OrderVersion}.xml directly sent to  queue"/&gt;
                              &lt;to uri="my queue"
                                  pattern="InOut" /&gt;
                      &lt;/camel:otherwise&gt;
                  &lt;/camel:choice&gt;
              &lt;/camel:route&gt;
              &lt;camel:route errorHandlerRef="errorHandler"&gt;
              &lt;!-- Route to put message from folder to JMS queue if memory consumption is below limit--&gt;
                  &lt;camel:from uri="file:data/inbox"/&gt;
                      &lt;camel:process ref="checkMemoryConsumption"/&gt;
                      &lt;camel:convertBodyTo type="String" /&gt;
                      &lt;camel:log message="Sucessfully processing service order ${headers.OrderNumber}-${headers.OrderVersion}.xml"/&gt;
                      &lt;to uri="my queue"
                              pattern="InOut" /&gt;
              &lt;/camel:route&gt;
  </code></pre>