Exception caused = Exchange.getProperty(Exchange.EXCEPTION_CAUGHT, Exception.class);
On Wed, Aug 26, 2009 at 1:46 PM, Bach Christian<[email protected]> wrote: > Heya > > How do I make Camel preserve the caught exception when putting a failed > exchange into a dead letter queue ? The below Camel code on execution, > clears the exception out. Is there a way to have exchanges in a dead > letter queue which have the original exception still set, so we can > report the particular exception which caused the exchange to fail, once > we take it off the queue ? > > /** > * All redelivery attempts failed so move the exchange to the dead > letter queue > */ > protected void deliverToFailureProcessor(final Processor processor, > final Exchange exchange, > final RedeliveryData data) > { > // we did not success with the redelivery so now we let the > failure processor handle it > // clear exception as we let the failure processor handle it > exchange.setException(null); > > if (data.handledPredicate != null && > data.handledPredicate.matches(exchange)) { > // its handled then remove traces of redelivery attempted > exchange.getIn().removeHeader(Exchange.REDELIVERED); > exchange.getIn().removeHeader(Exchange.REDELIVERY_COUNTER); > } else { > // must decrement the redelivery counter as we didn't > process the redelivery but is > // handling by the failure handler. So we must -1 to not let > the counter be out-of-sync > decrementRedeliveryCounter(exchange); > } > > Any help appreciated, thx, and regards, Christian. > > This message is for the named person's use only. It may contain confidential, > proprietary or legally privileged information. If you receive this message in > error, please notify the sender urgently and then immediately delete the > message and any copies of it from your system. Please also immediately > destroy any hardcopies of the message. > The sender's company reserves the right to monitor all e-mail communications > through their networks. > -- Claus Ibsen Apache Camel Committer Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus
