Return-Path: Delivered-To: apmail-camel-users-archive@www.apache.org Received: (qmail 58779 invoked from network); 16 Apr 2010 14:13:47 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 16 Apr 2010 14:13:47 -0000 Received: (qmail 60658 invoked by uid 500); 16 Apr 2010 14:13:47 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 60600 invoked by uid 500); 16 Apr 2010 14:13:46 -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 60592 invoked by uid 99); 16 Apr 2010 14:13:46 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 16 Apr 2010 14:13:46 +0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=FREEMAIL_FROM,SPF_HELO_PASS,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of lists@nabble.com designates 216.139.236.158 as permitted sender) Received: from [216.139.236.158] (HELO kuber.nabble.com) (216.139.236.158) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 16 Apr 2010 14:13:41 +0000 Received: from isper.nabble.com ([192.168.236.156]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1O2mIK-0007uv-QJ for users@camel.apache.org; Fri, 16 Apr 2010 07:13:20 -0700 Message-ID: <28267409.post@talk.nabble.com> Date: Fri, 16 Apr 2010 07:13:20 -0700 (PDT) From: dnn To: users@camel.apache.org Subject: Re: onException handling In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Nabble-From: Daniel.Nawrocki@ngc.com References: <28183226.post@talk.nabble.com> <28191045.post@talk.nabble.com> <28196117.post@talk.nabble.com> <28245275.post@talk.nabble.com> After a lot more digging, I've found what's really going on. I'm using Spring 2.5.6, Camel 2.2.0, ActiveMQ 5.3.1, Hibernate 3.4.0.GA, and Bitronix 1.3.3. The latest problem I was having (commit() call fails) was because Hibernate flushes itself to the DB as a pre-commit synchronization listener= .=20 If I manually called em.flush() the PK violation would be thrown in my application code and the Camel onException handlers would perform as expected. However, I decided that would not be a good way to go forward (what if the commit failed for some other reason?) and was left still searching for a solution. Since almost all of my routes start with a JMS queue, I decided to actually use the XA functionality in the software I'm using and let any exception cause a rollback all the way to ActiveMQ. After a certain number of rollbacks, ActiveMQ will move the message to a DLQ. I've added a route tha= t reads from the DLQ and does more or less the exact same actions my previous onException error handler did, but surrounded with a try/catch to prevent any errors in the DLQ route from causing an infinite loop. This seems more like an "enterprise" solution, and I probably should have used it from the beginning. Thanks for all your help Claus! Claus Ibsen-2 wrote: >=20 > On Wed, Apr 14, 2010 at 6:51 PM, dnn wrote: >> >> This one just won't die :) >> >> I've got the same issue, but caused in a slightly different way. =C2=A0T= he >> problem is when the DB commit fails (in my case, a unique constraint >> violation to an Oracle DB), the commit happens outside of the >> TransactionErrorHandler.super.process(exchange) block, and won't trigger >> the >> global onException handlers. >> >=20 > That is painful, the Oracle JDBC drivers is really bad. > You can try with XA to have both JMS + JDBC in the same orchestrated TM. >=20 >> I've tried to create a unit test to show the issue, but I cannot figure >> out >> how to make HSQL throw an exception at commit time. =C2=A0If anyone has = any >> tips >> I'd be happy to create a unit test. >> >=20 > Maybe some mock frameworks can do this. >=20 >=20 --=20 View this message in context: http://old.nabble.com/onException-handling-tp= 28183226p28267409.html Sent from the Camel - Users mailing list archive at Nabble.com.