Return-Path: Delivered-To: apmail-camel-users-archive@www.apache.org Received: (qmail 38091 invoked from network); 7 Apr 2009 06:58:04 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 7 Apr 2009 06:58:04 -0000 Received: (qmail 5558 invoked by uid 500); 7 Apr 2009 06:58:04 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 5491 invoked by uid 500); 7 Apr 2009 06:58:03 -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 5481 invoked by uid 99); 7 Apr 2009 06:58:03 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 07 Apr 2009 06:58:03 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of claus.ibsen@gmail.com designates 209.85.218.178 as permitted sender) Received: from [209.85.218.178] (HELO mail-bw0-f178.google.com) (209.85.218.178) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 07 Apr 2009 06:57:53 +0000 Received: by bwz26 with SMTP id 26so2150853bwz.20 for ; Mon, 06 Apr 2009 23:57:33 -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=CFYor1mNFL9UpPpXhOfFIIfWkqz0qUFFeyE3NPf7Dq4=; b=XQulC2cks10NWatQwxaW481c3kMvWkSPArfPA7iM5sKHeE3QLoEwGnMFJ9DGYHZlpr mZxNv3theDkjjwDK4qc1OVWGHRnBsjJqhD0ea+UgM/POPPcxChLDTTdwKcEsqNoE9JML rqBhnvPPSBd1RzXp4hZAauAjgno7lHKk5WM8c= 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=xLPncd+Zs3Mutq0OS8L5ugz0syOGamtZ4HpiQXJm7WJGcTuZ8Yvh5u/tSToPLXEF3E L72RihWMoMZyKfnm+Cv5z4y05U2maxggQwitrnykRNnz5c5+/NeJPgc6oqpH68YnOq4A VG6LzzFWECywl7PhYLDRAbEGEaUFFG5clrXO4= MIME-Version: 1.0 Received: by 10.223.123.210 with SMTP id q18mr1878884far.63.1239087452841; Mon, 06 Apr 2009 23:57:32 -0700 (PDT) In-Reply-To: <22916317.post@talk.nabble.com> References: <22916317.post@talk.nabble.com> From: Claus Ibsen Date: Tue, 7 Apr 2009 08:57:17 +0200 Message-ID: <5380c69c0904062357y71be25fdxb092f380168a392c@mail.gmail.com> Subject: Re: Capturing Exception Causing ActiveMQ Rollback 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 On Mon, Apr 6, 2009 at 10:12 PM, greenbean wrote: > > I would like to capture the exception that caused an ActiveMQ rollback wh= en > using Apache Camel. =A0I would also like to associate it with the message= (by > message id?) so that I can find the exception again when I am processing = the > message in an ActiveMQ DLQ. > > What is the best way to accomplish this with Apache Camel? =A0Currently I= am > using bean components that are abstracted from JMS. =A0Without Camel I wo= uld > catch the exception in onMessage and write it out along with the message = id > found in the Message object. =A0I don't really have this option when deal= ing > with bean components. > > Is there a way to place an interceptor in the ActiveMQ or transaction > components to let me capture the exception and JMS message id on rollback= ? Hi You can use the try .. catch style as the routing is transacted then it should be marked for rollback, the (*) rehtrow might not be needed, but if having it it more clearly state the intention like we will do in regular java code. from(jms) -> policy(required) -> tryBlock -> do your routing here -> handle(Exception.class) -> log exception and message id -> (*) rethrow -> end Note: In Camel 2.0 we have a new rollback DSL keyword you can use as well. And the onException also works with the transacted error handler in Camel 2= .0. > > Thanks. > -- > View this message in context: http://www.nabble.com/Capturing-Exception-C= ausing-ActiveMQ-Rollback-tp22916317p22916317.html > Sent from the Camel - Users (activemq) mailing list archive at Nabble.com= . > > --=20 Claus Ibsen Apache Camel Committer Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus Apache Camel Reference Card: http://refcardz.dzone.com/refcardz/enterprise-integration