Return-Path: Delivered-To: apmail-camel-users-archive@www.apache.org Received: (qmail 57775 invoked from network); 26 Aug 2009 11:53:45 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 26 Aug 2009 11:53:45 -0000 Received: (qmail 54212 invoked by uid 500); 26 Aug 2009 11:53:45 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 54139 invoked by uid 500); 26 Aug 2009 11:53:45 -0000 Mailing-List: contact users-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@camel.apache.org Delivered-To: mailing list users@camel.apache.org Received: (qmail 54129 invoked by uid 99); 26 Aug 2009 11:53:45 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 26 Aug 2009 11:53:45 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of claus.ibsen@gmail.com designates 209.85.220.216 as permitted sender) Received: from [209.85.220.216] (HELO mail-fx0-f216.google.com) (209.85.220.216) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 26 Aug 2009 11:53:34 +0000 Received: by fxm12 with SMTP id 12so59386fxm.20 for ; Wed, 26 Aug 2009 04:53:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :from:date:message-id:subject:to:content-type :content-transfer-encoding; bh=TAyrkwcOdTGw4a/M4ZJble0JPqpWDO5hWdhLwWn3cfA=; b=DaAwClxSrmjRVS5L042QlFJYZGPd5kUOPciKkUqmv0dydDarBNeELy+f/d7RS9002S JmK3uMJsTo52DsgzCtXegezwFzIzXozRmgUSGRmaDTF01q+8wbN7myUkNZPUmQKowmGZ 53giOgzws+4/yi1HxvX/LD+jDLeBHz0ZrBOvY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; b=GmgQxa/13SPe+9D0kV+YDjePMPARUYlEiQKE0Bjg9wLfDuqQOBJOnbAccqBUjkXOWX LFnbFs4ONuvHdY6px77oaK2mFctvywhaLYaoRUAEF2KnAAbev68kSfOmwj3p9FZRxxv3 uAHox3SX7RNfVScO/nLkYkAV2T/FKEa8f6IYs= MIME-Version: 1.0 Received: by 10.204.155.79 with SMTP id r15mr3580930bkw.142.1251287593093; Wed, 26 Aug 2009 04:53:13 -0700 (PDT) In-Reply-To: References: From: Claus Ibsen Date: Wed, 26 Aug 2009 13:52:53 +0200 Message-ID: <5380c69c0908260452x3630295eqfaba2f784f521deb@mail.gmail.com> Subject: Re: Dead Letter Queue, Exception Preservation Question. To: users@camel.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org Exception caused =3D Exchange.getProperty(Exchange.EXCEPTION_CAUGHT, Exception.class); On Wed, Aug 26, 2009 at 1:46 PM, Bach Christian 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 ? > > /** > =A0 =A0 * All redelivery attempts failed so move the exchange to the dead > letter queue > =A0 =A0 */ > =A0 =A0protected void deliverToFailureProcessor(final Processor processor= , > final Exchange exchange, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 final RedeliveryData data) > { > =A0 =A0 =A0 =A0// we did not success with the redelivery so now we let th= e > failure processor handle it > =A0 =A0 =A0 =A0// clear exception as we let the failure processor handle = it > =A0 =A0 =A0 =A0exchange.setException(null); > > =A0 =A0 =A0 =A0if (data.handledPredicate !=3D null && > data.handledPredicate.matches(exchange)) { > =A0 =A0 =A0 =A0 =A0 =A0// its handled then remove traces of redelivery at= tempted > =A0 =A0 =A0 =A0 =A0 =A0exchange.getIn().removeHeader(Exchange.REDELIVERED= ); > =A0 =A0 =A0 =A0 =A0 =A0exchange.getIn().removeHeader(Exchange.REDELIVERY_= COUNTER); > =A0 =A0 =A0 =A0} else { > =A0 =A0 =A0 =A0 =A0 =A0// must decrement the redelivery counter as we did= n't > process the redelivery but is > =A0 =A0 =A0 =A0 =A0 =A0// handling by the failure handler. So we must -1 = to not let > the counter be out-of-sync > =A0 =A0 =A0 =A0 =A0 =A0decrementRedeliveryCounter(exchange); > =A0 =A0 =A0 =A0} > > Any help appreciated, thx, and regards, Christian. > > This message is for the named person's use only. It may contain confident= ial, proprietary or legally privileged information. If you receive this mes= sage in error, please notify the sender urgently and then immediately delet= e the message and any copies of it from your system. Please also immediatel= y destroy any hardcopies of the message. > The sender's company reserves the right to monitor all e-mail communicati= ons through their networks. > --=20 Claus Ibsen Apache Camel Committer Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus