Return-Path: Delivered-To: apmail-camel-users-archive@www.apache.org Received: (qmail 43984 invoked from network); 2 Nov 2009 15:19:54 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 2 Nov 2009 15:19:54 -0000 Received: (qmail 31559 invoked by uid 500); 2 Nov 2009 15:19:54 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 31487 invoked by uid 500); 2 Nov 2009 15:19:53 -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 31477 invoked by uid 99); 2 Nov 2009 15:19:53 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 02 Nov 2009 15:19:53 +0000 X-ASF-Spam-Status: No, hits=-2.6 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of Christian.Schneider@enbw.com designates 195.35.72.126 as permitted sender) Received: from [195.35.72.126] (HELO mx1.enbw.com) (195.35.72.126) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 02 Nov 2009 15:19:50 +0000 Received: from s4b5046.enbw.net (unverified) by mx1.enbw.com (mailgate.enbw.com) with ESMTP id for ; Mon, 2 Nov 2009 16:18:45 +0100 Received: from S2B5021.enbw.net ([10.125.129.23]) by s4b5046.enbw.net with Microsoft SMTPSVC(6.0.3790.3959); Mon, 2 Nov 2009 16:19:28 +0100 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.5 Subject: AW: AW: AW: Problem with SOAP/JMS and transactions Date: Mon, 2 Nov 2009 16:19:27 +0100 Message-ID: In-Reply-To: <4AEEEF49.20203@gmail.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: AW: AW: Problem with SOAP/JMS and transactions Thread-Index: AcpbyoBtldTpCNY6TniEsII1IMq5jgABQjfQ References: <5380c69c0911020408u22a0f9e7icfaf3a39e0edaedb@mail.gmail.com> <4AEED30F.2050409@gmail.com> <4AEEDE31.70407@gmail.com> <5380c69c0911020556o364685cfx1306258a4f68cdc1@mail.gmail.com> <4AEEEF49.20203@gmail.com> From: "Schneider Christian" To: X-OriginalArrivalTime: 02 Nov 2009 15:19:28.0194 (UTC) FILETIME=[DE735A20:01CA5BCF] Hi Willem, thanks for the help. I can not compile camel at work - will try this = from home later. If it works I could even get it into our local distribution quickly as I had to build a custom version of camel-cxf anyway because = of the annotation issue. Greetings Christian Christian Schneider Team Handel und Risikomanagement Informationsverarbeitung Business Solutions Trading EnBW Systeme Infrastruktur Support GmbH Informationsverarbeitung=20 Business Solutions Handel und Dispatching Durlacher Allee 93 76131 Karlsruhe Tel : +49-(0)721-63-15482 Mail: christian.schneider@enbw.com Sitz der Gesellschaft: Karlsruhe Handelsregister: Amtsgericht Mannheim HRB 108550 Vorsitzender des Aufsichtsrats: Dr. Bernhard Beck Gesch=E4ftsf=FChrer: Jochen Adenau, Dr. Peter Krampf -----Urspr=FCngliche Nachricht----- Von: Willem Jiang [mailto:willem.jiang@gmail.com]=20 Gesendet: Montag, 2. November 2009 15:40 An: users@camel.apache.org Betreff: Re: AW: AW: Problem with SOAP/JMS and transactions Hi Christian, I'm glade it works on camel side. For the CXF side , I think we need to check the CXF message's exception=20 in the Camel transport and let camel throw the exception. Here is my patch on the latest trunk code (not be verified yet), please=20 feel free to give it a try. ### Eclipse Workspace Patch 1.0 #P camel-cxf Index:=20 src/main/java/org/apache/camel/component/cxf/transport/CamelDestination.j= ava =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D ---=20 src/main/java/org/apache/camel/component/cxf/transport/CamelDestination.j= ava (revision 831871) +++=20 src/main/java/org/apache/camel/component/cxf/transport/CamelDestination.j= ava (working copy) @@ -271,6 +271,12 @@ propagateResponseHeadersToCamel(outMessage, = camelExchange); + // check if the outMessage has an exception + Exception exception =3D = outMessage.getContent(Exception.class); + if (exception !=3D null) { + camelExchange.setException(exception); + } + CachedOutputStream outputStream =3D=20 (CachedOutputStream)outMessage.getContent(OutputStream.class); camelExchange.getOut().setBody(outputStream.getBytes()); getLogger().log(Level.FINE, "send the response message: "=20 + outputStream); Schneider Christian wrote: > Hi Claus, >=20 > I have replaced the cxf server with the folowing route: > > uri=3D"jms://queue.net.enbw.services.etg.examples.customerservice.Custome= rServ > ice" /> > > > =20 >=20 > Inside the Processor I simply throw a RuntimeException again. This > configuration works like expected. The transaction is rolled back and = the > message gets redelivered. I also had to configure my queue now for > maxRedeliveries to avoid a endless loop. >=20 > Btw. I think the redlivery could also be easily controlled inside = camel as > Tibco sets the property JMSXDeliveryCount. So I think this could also = be > handled in the route if the developer has no access to the jms server > config. >=20 > So this part works great.=20 >=20 > Thanks already for your help >=20 > Christian >=20 > Christian Schneider > Team Handel und Risikomanagement > Informationsverarbeitung Business Solutions Trading > EnBW Systeme Infrastruktur Support GmbH >=20 > Informationsverarbeitung=20 > Business Solutions > Handel und Dispatching > Durlacher Allee 93 > 76131 Karlsruhe >=20 > Tel : +49-(0)721-63-15482 > Mail: christian.schneider@enbw.com >=20 > Sitz der Gesellschaft: Karlsruhe > Handelsregister: Amtsgericht Mannheim HRB 108550 > Vorsitzender des Aufsichtsrats: Dr. Bernhard Beck > Gesch=E4ftsf=FChrer: Jochen Adenau, Dr. Peter Krampf >=20 > -----Urspr=FCngliche Nachricht----- > Von: Claus Ibsen [mailto:claus.ibsen@gmail.com]=20 > Gesendet: Montag, 2. November 2009 14:56 > An: users@camel.apache.org > Betreff: Re: AW: Problem with SOAP/JMS and transactions >=20 > On Mon, Nov 2, 2009 at 2:47 PM, Schneider Christian > wrote: >> Hi Willem, >> >> I also suspected it has to do with CXF Wrapping the Exception and not > simply >> rethrowing it. Do you think it would help to use pure CXF JMS = Transport? >> >> For the start I will try how Claus suggested to get transactions = working >> without CXF. When this works I will try again to get Camel CXF = working > with >> it. >> >=20 > You may be able to use >=20 > // catch the exceptions here you want to rollback > onException(Exception.class).markRollbackOnly(); >=20 > Which let Camel mark it as rollback in the spring TX manager. >=20 > And which hopefully is sufficient to mark it as rollback on the JMS > broker even thought CXF is wrapping the exception. > However this requires that Camel detects the exception before CXF does = :) >=20 > And to use the latest code from trunk. >=20 > But try out with CXF at first to get it working. >=20 >=20 >> Greetings >> >> Christian >> >> Christian Schneider >> Team Handel und Risikomanagement >> Informationsverarbeitung Business Solutions Trading >> EnBW Systeme Infrastruktur Support GmbH >> >> Informationsverarbeitung >> Business Solutions >> Handel und Dispatching >> Durlacher Allee 93 >> 76131 Karlsruhe >> >> Tel : +49-(0)721-63-15482 >> Mail: christian.schneider@enbw.com >> >> Sitz der Gesellschaft: Karlsruhe >> Handelsregister: Amtsgericht Mannheim HRB 108550 >> Vorsitzender des Aufsichtsrats: Dr. Bernhard Beck >> Gesch=E4ftsf=FChrer: Jochen Adenau, Dr. Peter Krampf >> >> -----Urspr=FCngliche Nachricht----- >> Von: Willem Jiang [mailto:willem.jiang@gmail.com] >> Gesendet: Montag, 2. November 2009 14:27 >> An: users@camel.apache.org >> Betreff: Re: AW: Problem with SOAP/JMS and transactions >> >> Hi Christian, >> >> I think it may relate to the CamelDestination just deal with input = and >> output stream. >> As you know if you throw the exception from the service impl, the >> exception will be caught by the CXF interceptor chain and it will be >> turned into a soap fault message, then be passed back to the client. >> >> Since the CamelDestination can't know the under layer message is the >> fault message, it can't throw the exception to let the camel-jms >> component roll back. >> >> Maybe we need to find another way to resolve your issue. >> >> Willem >> >> Schneider Christian wrote: >>> Hi Willem, >>> >>> I have adjusted my applicationContext but still my message gets >> acknowledged >>> instead of being rolled back. >>> >>> My service impl contains: >>> throw new RuntimeException("Test for transaction"); >>> >>> Any idea what still goes wrong? >>> >>> Greetings >>> >>> Christian >>> >>> ---- >>> >>> My applicationcontext now looks like the following. I have also = added >>> to the route for the server. >>> >>> >>> >>> >> xmlns:xsi=3D"http://www.w3.org/2001/XMLSchema-instance" >>> = xmlns:context=3D"http://www.springframework.org/schema/context" >>> = xsi:schemaLocation=3D"http://www.springframework.org/schema/beans >>> http://www.springframework.org/schema/beans/spring-beans-2.0.xsd >>> http://cxf.apache.org/core >>> http://cxf.apache.org/schemas/core.xsd >>> http://cxf.apache.org/jaxws >>> http://cxf.apache.org/schemas/jaxws.xsd >>> http://www.springframework.org/schema/context >>> http://www.springframework.org/schema/context/spring-context-2.5.xsd >>> http://camel.apache.org/schema/spring >>> http://camel.apache.org/schema/spring/camel-spring.xsd >>> http://cxf.apache.org/transports/camel >>> http://cxf.apache.org/transports/camel.xsd" >>> >>> >>> >>> >>> /> >>> >>> >>> >> >>> > class=3D"org.springframework.beans.factory.config.PropertyPlaceholderConf= igure >>> r"> >>> >>> >>> = classpath:jms.properties >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >> xmlns=3D"http://cxf.apache.org/jaxws" >>> = xmlns:service=3D"http://examples.etg.services.enbw.net/" >>> serviceName=3D"service:CustomerService" >>> endpointName=3D"service:CustomerServiceEndpoint" >>> address=3D"camel://direct:server" >>> implementor=3D"#serviceImpl"> >>> >>> >>> >>> >>> >>> >>> >> = xmlns:service=3D"http://examples.etg.services.enbw.net/" >>> serviceName=3D"service:CustomerService" >>> endpointName=3D"service:CustomerServiceEndpoint" >>> >>> > serviceClass=3D"net.enbw.services.etg.examples.customerservice.CustomerSe= rvice >>> V1" >>> address=3D"camel://direct:client"> >>> >>> >>> >>> >>> >>> >>> >> xmlns=3D"http://camel.apache.org/schema/spring"> >>> >>> >>> >> > uri=3D"jms://queue.net.enbw.services.etg.examples.customerservice.Custome= rServ >>> ice" /> >>> >>> >>> >> > uri=3D"jms://queue.net.enbw.services.etg.examples.customerservice.Custome= rServ >>> ice" /> >>> >>> >>> >>> >>> >>> >>> >> class=3D"org.apache.camel.component.jms.JmsComponent"> >>> >>> >>> >>> >> ref=3D"jmsConnectionFactory" /> >>> >>> >> = class=3D"org.apache.camel.component.jms.JmsConfiguration"> >>> /> >>> >> /> >>> >>> >> value=3D"${jms.receiveTimeout}" /> >>> >> value=3D"${jms.requestTimeout}" /> >>> >> value=3D"${jms.recoveryInterval}" /> >>> >>> >>> >>> >> ref=3D"jmsTransactionManager"/> >>> >>> >>> >> class=3D"org.springframework.jms.connection.JmsTransactionManager"> >>> >> ref=3D"jmsConnectionFactory" /> >>> >>> >>> >>> >> class=3D"com.tibco.tibjms.TibjmsConnectionFactory"> >>> >>> >>> /> >>> >> value=3D"${jms.reconnAttemptCount}" /> >>> >> value=3D"${jms.reconnAttemptDelay}" /> >>> >>> >>> >>> >> >=20 >=20 >=20