Return-Path: Delivered-To: apmail-camel-users-archive@www.apache.org Received: (qmail 37836 invoked from network); 4 Nov 2009 13:57:09 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 4 Nov 2009 13:57:09 -0000 Received: (qmail 56940 invoked by uid 500); 4 Nov 2009 13:57:09 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 56895 invoked by uid 500); 4 Nov 2009 13:57:08 -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 56885 invoked by uid 99); 4 Nov 2009 13:57:08 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 04 Nov 2009 13:57:08 +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.124 as permitted sender) Received: from [195.35.72.124] (HELO mx3.enbw.com) (195.35.72.124) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 04 Nov 2009 13:57:04 +0000 Received: from s4b5046.enbw.net (unverified) by mx3.enbw.com (mailgate.enbw.com) with ESMTP id for ; Wed, 4 Nov 2009 14:51:21 +0100 Received: from S2B5021.enbw.net ([10.125.129.23]) by s4b5046.enbw.net with Microsoft SMTPSVC(6.0.3790.3959); Wed, 4 Nov 2009 14:56:42 +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: AW: Problem with SOAP/JMS and transactions Date: Wed, 4 Nov 2009 14:56:37 +0100 Message-ID: In-Reply-To: <4AF0EC05.7040700@gmail.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: AW: AW: AW: Problem with SOAP/JMS and transactions Thread-Index: Acpc+cG7M6zQlHJqRDGpUTL357PxkQAMfTvQ References: <5380c69c0911020408u22a0f9e7icfaf3a39e0edaedb@mail.gmail.com> <4AEED30F.2050409@gmail.com> <4AEEDE31.70407@gmail.com> <5380c69c0911020556o364685cfx1306258a4f68cdc1@mail.gmail.com> <4AEEEF49.20203@gmail.com> <4AF0EC05.7040700@gmail.com> From: "Schneider Christian" To: X-OriginalArrivalTime: 04 Nov 2009 13:56:42.0409 (UTC) FILETIME=[A3703190:01CA5D56] Hi Willem, that is fine with me. I have closed the ticket. I have another exception problem though. I want to define a rule for the other exceptions that should not return a fault. I want these exceptions = to be forwarded into something like a dead letter queue after some retries. = I see two different ways to achieve this.=20 1) I could simply let them be rolled back and then use a filter for the = jms header JMSXDeliveryCount>n. So I could route any message that is = redelivered for the n=B4th time to a dead letter queue. 2) I could use an onException clause like below. To let camel do the redeliveries and send to a dead letter queue after 4 tries. java.lang.Exception true I have not yet done 1) but have a problem with 2). It seems that when I = set handled to true then the "to" part is not executed. If I leave out = "handled" then the message is put into the deadLetter queue but rolled back later. The only way I was able to really send to the deadLetter queue wasby = turning of transactions completely. Any idea what I am doing wrong? 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: Mittwoch, 4. November 2009 03:51 An: users@camel.apache.org Betreff: Re: AW: AW: AW: Problem with SOAP/JMS and transactions Hi Christian, I saw the issue and submitted a patch for it. BTW, I think onException is a good way to resolve your customer=20 exception issue. Willem Schneider Christian wrote: > Hi Willem, >=20 > I have built a camel-cxf module that includes your patch. Now the = rollback > basically works. > The problem is that it happens for all exceptions. I think a good = default > would be to return a fault for all exceptions that the service = explicitly > defines and roll back for all other exceptions. The problem is I have = no > idea how this could be done. >=20 > In the meantime I will try to use a onException() clause to do this > differentiation. >=20 > I have also created a jira issue for the whole problem. > https://issues.apache.org/activemq/browse/CAMEL-2128 >=20 >=20 > Greetings >=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: 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 >=20 > Hi Christian, >=20 > 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. >=20 > Here is my patch on the latest trunk code (not be verified yet), = please=20 > feel free to give it a try. >=20 > ### 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 >=20 > (revision 831871) > +++=20 > src/main/java/org/apache/camel/component/cxf/transport/CamelDestination.j= ava >=20 > (working copy) > @@ -271,6 +271,12 @@ >=20 > propagateResponseHeadersToCamel(outMessage, = camelExchange); >=20 > + // 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); >=20 >=20 >=20 > Schneider Christian wrote: >> Hi Claus, >> >> I have replaced the cxf server with the folowing route: >> >> > > uri=3D"jms://queue.net.enbw.services.etg.examples.customerservice.Custome= rServ >> ice" /> >> >> >> =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. >> >> 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. >> >> So this part works great.=20 >> >> Thanks already for your help >> >> 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: 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 >> >> 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. >>> >> You may be able to use >> >> // catch the exceptions here you want to rollback >> onException(Exception.class).markRollbackOnly(); >> >> Which let Camel mark it as rollback in the spring TX manager. >> >> 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 :) >> >> And to use the latest code from trunk. >> >> But try out with CXF at first to get it working. >> >> >>> 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"TRANSACTED" >>>> /> >>>> >>>> >>> 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