|
View:
New views
20 Messages
—
Rating Filter:
Alert me
|
| < Prev | 1 - 2 | Next > |
|
|
Problem with SOAP/JMS and transactionsHi,
I am currently trying to get transactions for SOAP/JMS running. I am using camel-cxf for SOAP handling and camel-jms for jms connections. I have a request reply service that should be able to do three different things: - no exception occurs in the implementation: The jms Message should be committed and the normal reply should be sent - The implementation throws an exception defined in the service contract: The jms message should be committed and a fault should be sent - The implemementation throws another kind of exception: The message should be rolled back so it can be received again In my service impl I tried throwing a RuntimeException or Error. In both cases my jms message was committed and a fault was sent back to the client. I have attached my spring config. Is there anything I have to add to control how exceptions influence the transaction? I also have another question. When my transaction is rolled back, how can I avoid running into an endless loop where the server always consumes the message and then rolls it back because of the exception? 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@... Sitz der Gesellschaft: Karlsruhe Handelsregister: Amtsgericht Mannheim HRB 108550 Vorsitzender des Aufsichtsrats: Dr. Bernhard Beck Geschäftsführer: Jochen Adenau, Dr. Peter Krampf ------ <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="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" > <context:annotation-config/> <import resource="classpath:META-INF/cxf/cxf.xml" /> <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" /> <import resource="classpath:META-INF/cxf/cxf-extension-camel.xml" /> <bean id="configProps" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigure r"> <property name="locations"> <list> <value>classpath:jms.properties</value> </list> </property> </bean> <bean id="appModule" class="net.enbw.endur.AppModule"> <property name="customerService" ref="customerService"/> </bean> <bean id="serviceImpl" class="net.enbw.endur.ServiceImpl"> </bean> <!-- SOA configs below --> <endpoint id="customerServiceEndpoint" xmlns="http://cxf.apache.org/jaxws" xmlns:service="http://examples.etg.services.enbw.net/" serviceName="service:CustomerService" endpointName="service:CustomerServiceEndpoint" address="camel://jms:queue.net.enbw.services.etg.examples.customerservice.Cu stomerService" implementor="#serviceImpl"> <features> <!-- Enables logging of SOAP messages. --> <logging xmlns="http://cxf.apache.org/core" /> </features> </endpoint> <client id="customerService" xmlns="http://cxf.apache.org/jaxws" xmlns:service="http://examples.etg.services.enbw.net/" serviceName="service:CustomerService" endpointName="service:CustomerServiceEndpoint" serviceClass="net.enbw.services.etg.examples.customerservice.CustomerService V1" address="camel://jms:queue.net.enbw.services.etg.examples.customerservice.Cu stomerService"> <features> <!-- Enables logging of SOAP messages. --> <!-- logging xmlns="http://cxf.apache.org/core" /--> </features> </client> <camelContext id="camelContext" trace="false" xmlns="http://camel.apache.org/schema/spring"> </camelContext> <bean id="jms" class="org.apache.camel.component.jms.JmsComponent"> <constructor-arg index="0"> <ref bean="jmsConfiguration" /> </constructor-arg> <property name="connectionFactory" ref="jmsConnectionFactory" /> </bean> <bean id="jmsConfiguration" class="org.apache.camel.component.jms.JmsConfiguration"> <property name="useMessageIDAsCorrelationID" value="true" /> <property name="acknowledgementModeName" value="TRANSACTED" /> <property name="explicitQosEnabled" value="true" /> <property name="receiveTimeout" value="${jms.receiveTimeout}" /> <property name="requestTimeout" value="${jms.requestTimeout}" /> <property name="recoveryInterval" value="${jms.recoveryInterval}" /> <property name="timeToLive" value="${jms.timeToLive}" /> <property name="transacted" value="true" /> <property name="transactedInOut" value="true" /> <property name="transactionManager" ref="jmsTransactionManager"/> </bean> <bean id="jmsTransactionManager" class="org.springframework.jms.connection.JmsTransactionManager"> <property name="connectionFactory" ref="jmsConnectionFactory" /> </bean> <bean id="jmsConnectionFactory" class="com.tibco.tibjms.TibjmsConnectionFactory"> <property name="serverUrl" value="${jms.serverUrl}" /> <property name="userName" value="${jms.userName}" /> <property name="userPassword" value="${jms.userPassword}" /> <property name="reconnAttemptCount" value="${jms.reconnAttemptCount}" /> <property name="reconnAttemptDelay" value="${jms.reconnAttemptDelay}" /> </bean> </beans> |
|
|
Re: Problem with SOAP/JMS and transactionsOn Mon, Nov 2, 2009 at 12:02 PM, Schneider Christian
<Christian.Schneider@...> wrote: > Hi, > > I am currently trying to get transactions for SOAP/JMS running. I am using > camel-cxf for SOAP handling and camel-jms for jms connections. > > I have a request reply service that should be able to do three different > things: > > - no exception occurs in the implementation: The jms Message should be > committed and the normal reply should be sent > - The implementation throws an exception defined in the service contract: > The jms message should be committed and a fault should be sent > - The implemementation throws another kind of exception: The message should > be rolled back so it can be received again > > In my service impl I tried throwing a RuntimeException or Error. In both > cases my jms message was committed and a fault was sent back to the client. > > I have attached my spring config. Is there anything I have to add to control > how exceptions influence the transaction? > > I also have another question. When my transaction is rolled back, how can I > avoid running into an endless loop where the server always consumes the > message and then rolls it back because of the exception? > You need to configure the redelivery policy of your JMS broker for that For example with AMQ its: http://activemq.apache.org/redelivery-policy.html But for Tibco you gotta resort to their documentation how to do that. > 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@... > > Sitz der Gesellschaft: Karlsruhe > Handelsregister: Amtsgericht Mannheim HRB 108550 > Vorsitzender des Aufsichtsrats: Dr. Bernhard Beck > Geschäftsführer: Jochen Adenau, Dr. Peter Krampf > > > ------ > > <beans xmlns="http://www.springframework.org/schema/beans" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xmlns:context="http://www.springframework.org/schema/context" > xsi:schemaLocation="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" >> > <context:annotation-config/> > > <import resource="classpath:META-INF/cxf/cxf.xml" /> > <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" /> > <import resource="classpath:META-INF/cxf/cxf-extension-camel.xml" /> > > <bean id="configProps" > > class="org.springframework.beans.factory.config.PropertyPlaceholderConfigure > r"> > <property name="locations"> > <list> > <value>classpath:jms.properties</value> > </list> > </property> > </bean> > > <bean id="appModule" class="net.enbw.endur.AppModule"> > <property name="customerService" ref="customerService"/> > </bean> > > <bean id="serviceImpl" class="net.enbw.endur.ServiceImpl"> > </bean> > > <!-- SOA configs below --> > > <endpoint id="customerServiceEndpoint" > xmlns="http://cxf.apache.org/jaxws" > xmlns:service="http://examples.etg.services.enbw.net/" > serviceName="service:CustomerService" > endpointName="service:CustomerServiceEndpoint" > > address="camel://jms:queue.net.enbw.services.etg.examples.customerservice.Cu > stomerService" > implementor="#serviceImpl"> > <features> > <!-- Enables logging of SOAP messages. --> > <logging xmlns="http://cxf.apache.org/core" /> > </features> > </endpoint> > > <client id="customerService" xmlns="http://cxf.apache.org/jaxws" > xmlns:service="http://examples.etg.services.enbw.net/" > serviceName="service:CustomerService" > endpointName="service:CustomerServiceEndpoint" > > serviceClass="net.enbw.services.etg.examples.customerservice.CustomerService > V1" > > address="camel://jms:queue.net.enbw.services.etg.examples.customerservice.Cu > stomerService"> > <features> > <!-- Enables logging of SOAP messages. --> > <!-- logging xmlns="http://cxf.apache.org/core" /--> > </features> > </client> > > <camelContext id="camelContext" trace="false" > xmlns="http://camel.apache.org/schema/spring"> > </camelContext> > > <bean id="jms" > class="org.apache.camel.component.jms.JmsComponent"> > <constructor-arg index="0"> > <ref bean="jmsConfiguration" /> > </constructor-arg> > <property name="connectionFactory" > ref="jmsConnectionFactory" /> > </bean> > <bean id="jmsConfiguration" > class="org.apache.camel.component.jms.JmsConfiguration"> > <property name="useMessageIDAsCorrelationID" value="true" /> > <property name="acknowledgementModeName" value="TRANSACTED" > /> > <property name="explicitQosEnabled" value="true" /> > <property name="receiveTimeout" > value="${jms.receiveTimeout}" /> > <property name="requestTimeout" > value="${jms.requestTimeout}" /> > <property name="recoveryInterval" > value="${jms.recoveryInterval}" /> > <property name="timeToLive" value="${jms.timeToLive}" /> > <property name="transacted" value="true" /> > <property name="transactedInOut" value="true" /> > <property name="transactionManager" > ref="jmsTransactionManager"/> > </bean> > > <bean id="jmsTransactionManager" > class="org.springframework.jms.connection.JmsTransactionManager"> > <property name="connectionFactory" > ref="jmsConnectionFactory" /> > </bean> > > <bean id="jmsConnectionFactory" > class="com.tibco.tibjms.TibjmsConnectionFactory"> > <property name="serverUrl" value="${jms.serverUrl}" /> > <property name="userName" value="${jms.userName}" /> > <property name="userPassword" value="${jms.userPassword}" /> > <property name="reconnAttemptCount" > value="${jms.reconnAttemptCount}" /> > <property name="reconnAttemptDelay" > value="${jms.reconnAttemptDelay}" /> > </bean> > > </beans> > > -- Claus Ibsen Apache Camel Committer Author of Camel in Action: http://www.manning.com/ibsen/ Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus |
|
|
Re: Problem with SOAP/JMS and transactionsHi Christian
If you want the redelivery policy take effect, you need to change your camel context like this <camelContext id="camelContext" trace="false" xmlns="http://camel.apache.org/schema/spring"> <route> <from uri="direct:client"/> <to uri="camel://jms:queue.net.enbw.services.etg.examples.customerservice.CustomerService" /> </route> <from uri="camel://jms:queue.net.enbw.services.etg.examples.customerservice.CustomerService" <to uri="direct:server"> </route> </camelContext> And you client's address should camel://direct:client, server's address should be camel://direct:server Willem Claus Ibsen wrote: > On Mon, Nov 2, 2009 at 12:02 PM, Schneider Christian > <Christian.Schneider@...> wrote: >> Hi, >> >> I am currently trying to get transactions for SOAP/JMS running. I am using >> camel-cxf for SOAP handling and camel-jms for jms connections. >> >> I have a request reply service that should be able to do three different >> things: >> >> - no exception occurs in the implementation: The jms Message should be >> committed and the normal reply should be sent >> - The implementation throws an exception defined in the service contract: >> The jms message should be committed and a fault should be sent >> - The implemementation throws another kind of exception: The message should >> be rolled back so it can be received again >> >> In my service impl I tried throwing a RuntimeException or Error. In both >> cases my jms message was committed and a fault was sent back to the client. >> >> I have attached my spring config. Is there anything I have to add to control >> how exceptions influence the transaction? >> >> I also have another question. When my transaction is rolled back, how can I >> avoid running into an endless loop where the server always consumes the >> message and then rolls it back because of the exception? >> > > You need to configure the redelivery policy of your JMS broker for that > > For example with AMQ its: > http://activemq.apache.org/redelivery-policy.html > > But for Tibco you gotta resort to their documentation how to do that. > > > > >> 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@... >> >> Sitz der Gesellschaft: Karlsruhe >> Handelsregister: Amtsgericht Mannheim HRB 108550 >> Vorsitzender des Aufsichtsrats: Dr. Bernhard Beck >> Geschäftsführer: Jochen Adenau, Dr. Peter Krampf >> >> >> ------ >> >> <beans xmlns="http://www.springframework.org/schema/beans" >> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >> xmlns:context="http://www.springframework.org/schema/context" >> xsi:schemaLocation="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" >> <context:annotation-config/> >> >> <import resource="classpath:META-INF/cxf/cxf.xml" /> >> <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" /> >> <import resource="classpath:META-INF/cxf/cxf-extension-camel.xml" /> >> >> <bean id="configProps" >> >> class="org.springframework.beans.factory.config.PropertyPlaceholderConfigure >> r"> >> <property name="locations"> >> <list> >> <value>classpath:jms.properties</value> >> </list> >> </property> >> </bean> >> >> <bean id="appModule" class="net.enbw.endur.AppModule"> >> <property name="customerService" ref="customerService"/> >> </bean> >> >> <bean id="serviceImpl" class="net.enbw.endur.ServiceImpl"> >> </bean> >> >> <!-- SOA configs below --> >> >> <endpoint id="customerServiceEndpoint" >> xmlns="http://cxf.apache.org/jaxws" >> xmlns:service="http://examples.etg.services.enbw.net/" >> serviceName="service:CustomerService" >> endpointName="service:CustomerServiceEndpoint" >> >> address="camel://jms:queue.net.enbw.services.etg.examples.customerservice.Cu >> stomerService" >> implementor="#serviceImpl"> >> <features> >> <!-- Enables logging of SOAP messages. --> >> <logging xmlns="http://cxf.apache.org/core" /> >> </features> >> </endpoint> >> >> <client id="customerService" xmlns="http://cxf.apache.org/jaxws" >> xmlns:service="http://examples.etg.services.enbw.net/" >> serviceName="service:CustomerService" >> endpointName="service:CustomerServiceEndpoint" >> >> serviceClass="net.enbw.services.etg.examples.customerservice.CustomerService >> V1" >> >> address="camel://jms:queue.net.enbw.services.etg.examples.customerservice.Cu >> stomerService"> >> <features> >> <!-- Enables logging of SOAP messages. --> >> <!-- logging xmlns="http://cxf.apache.org/core" /--> >> </features> >> </client> >> >> <camelContext id="camelContext" trace="false" >> xmlns="http://camel.apache.org/schema/spring"> >> </camelContext> >> >> <bean id="jms" >> class="org.apache.camel.component.jms.JmsComponent"> >> <constructor-arg index="0"> >> <ref bean="jmsConfiguration" /> >> </constructor-arg> >> <property name="connectionFactory" >> ref="jmsConnectionFactory" /> >> </bean> >> <bean id="jmsConfiguration" >> class="org.apache.camel.component.jms.JmsConfiguration"> >> <property name="useMessageIDAsCorrelationID" value="true" /> >> <property name="acknowledgementModeName" value="TRANSACTED" >> /> >> <property name="explicitQosEnabled" value="true" /> >> <property name="receiveTimeout" >> value="${jms.receiveTimeout}" /> >> <property name="requestTimeout" >> value="${jms.requestTimeout}" /> >> <property name="recoveryInterval" >> value="${jms.recoveryInterval}" /> >> <property name="timeToLive" value="${jms.timeToLive}" /> >> <property name="transacted" value="true" /> >> <property name="transactedInOut" value="true" /> >> <property name="transactionManager" >> ref="jmsTransactionManager"/> >> </bean> >> >> <bean id="jmsTransactionManager" >> class="org.springframework.jms.connection.JmsTransactionManager"> >> <property name="connectionFactory" >> ref="jmsConnectionFactory" /> >> </bean> >> >> <bean id="jmsConnectionFactory" >> class="com.tibco.tibjms.TibjmsConnectionFactory"> >> <property name="serverUrl" value="${jms.serverUrl}" /> >> <property name="userName" value="${jms.userName}" /> >> <property name="userPassword" value="${jms.userPassword}" /> >> <property name="reconnAttemptCount" >> value="${jms.reconnAttemptCount}" /> >> <property name="reconnAttemptDelay" >> value="${jms.reconnAttemptDelay}" /> >> </bean> >> >> </beans> >> >> > > > |
|
|
AW: Problem with SOAP/JMS and transactionsHi Claus,
thanks for the hint. I have found how to control redelivery in Tibco JMS. Do you have any idea why the rollback in my example does not work? If someone else needs to tune this on Tibco EMS: You can set maxRedelivery=n on a queue config. This means that messages in the queue are redelivered only n times. Additionally a message can specify the property JMS_TIBCO_PRESERVE_UNDELIVERED=true. This means the message is delivered to the undelivered messages queue after n attempts instead of being discarded. 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@... Sitz der Gesellschaft: Karlsruhe Handelsregister: Amtsgericht Mannheim HRB 108550 Vorsitzender des Aufsichtsrats: Dr. Bernhard Beck Geschäftsführer: Jochen Adenau, Dr. Peter Krampf -----Ursprüngliche Nachricht----- Von: Claus Ibsen [mailto:claus.ibsen@...] Gesendet: Montag, 2. November 2009 13:08 An: users@... Betreff: Re: Problem with SOAP/JMS and transactions On Mon, Nov 2, 2009 at 12:02 PM, Schneider Christian <Christian.Schneider@...> wrote: > Hi, > > I am currently trying to get transactions for SOAP/JMS running. I am using > camel-cxf for SOAP handling and camel-jms for jms connections. > > I have a request reply service that should be able to do three different > things: > > - no exception occurs in the implementation: The jms Message should be > committed and the normal reply should be sent > - The implementation throws an exception defined in the service contract: > The jms message should be committed and a fault should be sent > - The implemementation throws another kind of exception: The message > be rolled back so it can be received again > > In my service impl I tried throwing a RuntimeException or Error. In both > cases my jms message was committed and a fault was sent back to the client. > > I have attached my spring config. Is there anything I have to add to control > how exceptions influence the transaction? > > I also have another question. When my transaction is rolled back, how can I > avoid running into an endless loop where the server always consumes the > message and then rolls it back because of the exception? > You need to configure the redelivery policy of your JMS broker for that For example with AMQ its: http://activemq.apache.org/redelivery-policy.html But for Tibco you gotta resort to their documentation how to do that. > 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@... > > Sitz der Gesellschaft: Karlsruhe > Handelsregister: Amtsgericht Mannheim HRB 108550 > Vorsitzender des Aufsichtsrats: Dr. Bernhard Beck > Geschäftsführer: Jochen Adenau, Dr. Peter Krampf > > > ------ > > <beans xmlns="http://www.springframework.org/schema/beans" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xmlns:context="http://www.springframework.org/schema/context" > xsi:schemaLocation="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" >> > <context:annotation-config/> > > <import resource="classpath:META-INF/cxf/cxf.xml" /> > <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" /> > <import resource="classpath:META-INF/cxf/cxf-extension-camel.xml" > > <bean id="configProps" > > class="org.springframework.beans.factory.config.PropertyPlaceholderConfigure > r"> > <property name="locations"> > <list> > <value>classpath:jms.properties</value> > </list> > </property> > </bean> > > <bean id="appModule" class="net.enbw.endur.AppModule"> > <property name="customerService" ref="customerService"/> > </bean> > > <bean id="serviceImpl" class="net.enbw.endur.ServiceImpl"> > </bean> > > <!-- SOA configs below --> > > <endpoint id="customerServiceEndpoint" > xmlns="http://cxf.apache.org/jaxws" > xmlns:service="http://examples.etg.services.enbw.net/" > serviceName="service:CustomerService" > endpointName="service:CustomerServiceEndpoint" > > > stomerService" > implementor="#serviceImpl"> > <features> > <!-- Enables logging of SOAP messages. --> > <logging xmlns="http://cxf.apache.org/core" /> > </features> > </endpoint> > > <client id="customerService" xmlns="http://cxf.apache.org/jaxws" > xmlns:service="http://examples.etg.services.enbw.net/" > serviceName="service:CustomerService" > endpointName="service:CustomerServiceEndpoint" > > > V1" > > address="camel://jms:queue.net.enbw.services.etg.examples.customerservice.Cu > stomerService"> > <features> > <!-- Enables logging of SOAP messages. --> > <!-- logging xmlns="http://cxf.apache.org/core" /--> > </features> > </client> > > <camelContext id="camelContext" trace="false" > xmlns="http://camel.apache.org/schema/spring"> > </camelContext> > > <bean id="jms" > class="org.apache.camel.component.jms.JmsComponent"> > <constructor-arg index="0"> > <ref bean="jmsConfiguration" /> > </constructor-arg> > <property name="connectionFactory" > ref="jmsConnectionFactory" /> > </bean> > <bean id="jmsConfiguration" > class="org.apache.camel.component.jms.JmsConfiguration"> > <property name="useMessageIDAsCorrelationID" value="true" > <property name="acknowledgementModeName" value="TRANSACTED" > /> > <property name="explicitQosEnabled" value="true" /> > <property name="receiveTimeout" > value="${jms.receiveTimeout}" /> > <property name="requestTimeout" > value="${jms.requestTimeout}" /> > <property name="recoveryInterval" > value="${jms.recoveryInterval}" /> > <property name="timeToLive" value="${jms.timeToLive}" /> > <property name="transacted" value="true" /> > <property name="transactedInOut" value="true" /> > <property name="transactionManager" > ref="jmsTransactionManager"/> > </bean> > > <bean id="jmsTransactionManager" > class="org.springframework.jms.connection.JmsTransactionManager"> > <property name="connectionFactory" > ref="jmsConnectionFactory" /> > </bean> > > <bean id="jmsConnectionFactory" > class="com.tibco.tibjms.TibjmsConnectionFactory"> > <property name="serverUrl" value="${jms.serverUrl}" /> > <property name="userName" value="${jms.userName}" /> > <property name="userPassword" value="${jms.userPassword}" > <property name="reconnAttemptCount" > value="${jms.reconnAttemptCount}" /> > <property name="reconnAttemptDelay" > value="${jms.reconnAttemptDelay}" /> > </bean> > > </beans> > > -- Claus Ibsen Apache Camel Committer Author of Camel in Action: http://www.manning.com/ibsen/ Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus |
|
|
AW: Problem with SOAP/JMS and transactionsHi 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 <transacted/> to the route for the server. <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="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" > <context:annotation-config/> <import resource="classpath:META-INF/cxf/cxf.xml" /> <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" /> <import resource="classpath:META-INF/cxf/cxf-extension-camel.xml" /> <import resource="classpath:serviceRuntimeContext.xml" /> <bean id="configProps" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigure r"> <property name="locations"> <list> <value>classpath:jms.properties</value> </list> </property> </bean> <!-- Make sure to read the best practices for design and implementation before developing a service for production use. http://wissen.enbw.net/display/etgsoa/3+-+Design http://wissen.enbw.net/display/etgsoa/4+-+Entwicklung --> <bean id="appModule" class="net.enbw.endur.AppModule"> <property name="customerService" ref="customerService"/> </bean> <bean id="serviceImpl" class="net.enbw.endur.ServiceImpl"> </bean> <!-- SOA configs below --> <endpoint id="customerServiceEndpoint" xmlns="http://cxf.apache.org/jaxws" xmlns:service="http://examples.etg.services.enbw.net/" serviceName="service:CustomerService" endpointName="service:CustomerServiceEndpoint" address="camel://direct:server" implementor="#serviceImpl"> <features> <!-- Enables logging of SOAP messages. --> <logging xmlns="http://cxf.apache.org/core" /> </features> </endpoint> <client id="customerService" xmlns="http://cxf.apache.org/jaxws" xmlns:service="http://examples.etg.services.enbw.net/" serviceName="service:CustomerService" endpointName="service:CustomerServiceEndpoint" serviceClass="net.enbw.services.etg.examples.customerservice.CustomerService V1" address="camel://direct:client"> <features> <!-- Enables logging of SOAP messages. --> <!-- logging xmlns="http://cxf.apache.org/core" /--> </features> </client> <camelContext id="camelContext" trace="false" xmlns="http://camel.apache.org/schema/spring"> <route> <from uri="direct:client"/> <to uri="jms://queue.net.enbw.services.etg.examples.customerservice.CustomerServ ice" /> </route> <route> <from uri="jms://queue.net.enbw.services.etg.examples.customerservice.CustomerServ ice" /> <transacted/> <to uri="direct:server" /> </route> </camelContext> <!-- See http://camel.apache.org/jms.html --> <bean id="jms" class="org.apache.camel.component.jms.JmsComponent"> <constructor-arg index="0"> <ref bean="jmsConfiguration" /> </constructor-arg> <property name="connectionFactory" ref="jmsConnectionFactory" /> </bean> <bean id="jmsConfiguration" class="org.apache.camel.component.jms.JmsConfiguration"> <property name="useMessageIDAsCorrelationID" value="true" /> <property name="acknowledgementModeName" value="TRANSACTED" /> <property name="explicitQosEnabled" value="true" /> <property name="receiveTimeout" value="${jms.receiveTimeout}" /> <property name="requestTimeout" value="${jms.requestTimeout}" /> <property name="recoveryInterval" value="${jms.recoveryInterval}" /> <property name="timeToLive" value="${jms.timeToLive}" /> <property name="transacted" value="true" /> <property name="transactedInOut" value="true" /> <property name="transactionManager" ref="jmsTransactionManager"/> </bean> <bean id="jmsTransactionManager" class="org.springframework.jms.connection.JmsTransactionManager"> <property name="connectionFactory" ref="jmsConnectionFactory" /> </bean> <!-- See Tibco EMS documentation --> <bean id="jmsConnectionFactory" class="com.tibco.tibjms.TibjmsConnectionFactory"> <property name="serverUrl" value="${jms.serverUrl}" /> <property name="userName" value="${jms.userName}" /> <property name="userPassword" value="${jms.userPassword}" /> <property name="reconnAttemptCount" value="${jms.reconnAttemptCount}" /> <property name="reconnAttemptDelay" value="${jms.reconnAttemptDelay}" /> </bean> </beans> |
|
|
Re: Problem with SOAP/JMS and transactionsHi
Try without CXF in the mix and just plain Tibco and Camel and get that working. On Mon, Nov 2, 2009 at 2:10 PM, Schneider Christian <Christian.Schneider@...> 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 > <transacted/> to the route for the server. > > > > <beans xmlns="http://www.springframework.org/schema/beans" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xmlns:context="http://www.springframework.org/schema/context" > xsi:schemaLocation="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" >> > <context:annotation-config/> > > <import resource="classpath:META-INF/cxf/cxf.xml" /> > <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" /> > <import resource="classpath:META-INF/cxf/cxf-extension-camel.xml" /> > <import resource="classpath:serviceRuntimeContext.xml" /> > > <bean id="configProps" > > class="org.springframework.beans.factory.config.PropertyPlaceholderConfigure > r"> > <property name="locations"> > <list> > <value>classpath:jms.properties</value> > </list> > </property> > </bean> > > <!-- Make sure to read the best practices for design and > implementation before > developing a service for production use. > http://wissen.enbw.net/display/etgsoa/3+-+Design > http://wissen.enbw.net/display/etgsoa/4+-+Entwicklung > --> > <bean id="appModule" class="net.enbw.endur.AppModule"> > <property name="customerService" ref="customerService"/> > </bean> > > <bean id="serviceImpl" class="net.enbw.endur.ServiceImpl"> > </bean> > > <!-- SOA configs below --> > > <endpoint id="customerServiceEndpoint" > xmlns="http://cxf.apache.org/jaxws" > xmlns:service="http://examples.etg.services.enbw.net/" > serviceName="service:CustomerService" > endpointName="service:CustomerServiceEndpoint" > address="camel://direct:server" > implementor="#serviceImpl"> > <features> > <!-- Enables logging of SOAP messages. --> > <logging xmlns="http://cxf.apache.org/core" /> > </features> > </endpoint> > > <client id="customerService" xmlns="http://cxf.apache.org/jaxws" > xmlns:service="http://examples.etg.services.enbw.net/" > serviceName="service:CustomerService" > endpointName="service:CustomerServiceEndpoint" > > serviceClass="net.enbw.services.etg.examples.customerservice.CustomerService > V1" > address="camel://direct:client"> > <features> > <!-- Enables logging of SOAP messages. --> > <!-- logging xmlns="http://cxf.apache.org/core" /--> > </features> > </client> > > <camelContext id="camelContext" trace="false" > xmlns="http://camel.apache.org/schema/spring"> > <route> > <from uri="direct:client"/> > <to > uri="jms://queue.net.enbw.services.etg.examples.customerservice.CustomerServ > ice" /> > </route> > <route> > <from > uri="jms://queue.net.enbw.services.etg.examples.customerservice.CustomerServ > ice" /> > <transacted/> > <to uri="direct:server" /> > </route> > </camelContext> > > <!-- See http://camel.apache.org/jms.html --> > <bean id="jms" > class="org.apache.camel.component.jms.JmsComponent"> > <constructor-arg index="0"> > <ref bean="jmsConfiguration" /> > </constructor-arg> > <property name="connectionFactory" > ref="jmsConnectionFactory" /> > </bean> > <bean id="jmsConfiguration" > class="org.apache.camel.component.jms.JmsConfiguration"> > <property name="useMessageIDAsCorrelationID" value="true" /> > <property name="acknowledgementModeName" value="TRANSACTED" > /> > <property name="explicitQosEnabled" value="true" /> > <property name="receiveTimeout" > value="${jms.receiveTimeout}" /> > <property name="requestTimeout" > value="${jms.requestTimeout}" /> > <property name="recoveryInterval" > value="${jms.recoveryInterval}" /> > <property name="timeToLive" value="${jms.timeToLive}" /> > <property name="transacted" value="true" /> > <property name="transactedInOut" value="true" /> > <property name="transactionManager" > ref="jmsTransactionManager"/> > </bean> > > <bean id="jmsTransactionManager" > class="org.springframework.jms.connection.JmsTransactionManager"> > <property name="connectionFactory" > ref="jmsConnectionFactory" /> > </bean> > > <!-- See Tibco EMS documentation --> > <bean id="jmsConnectionFactory" > class="com.tibco.tibjms.TibjmsConnectionFactory"> > <property name="serverUrl" value="${jms.serverUrl}" /> > <property name="userName" value="${jms.userName}" /> > <property name="userPassword" value="${jms.userPassword}" /> > <property name="reconnAttemptCount" > value="${jms.reconnAttemptCount}" /> > <property name="reconnAttemptDelay" > value="${jms.reconnAttemptDelay}" /> > </bean> > > </beans> > -- Claus Ibsen Apache Camel Committer Author of Camel in Action: http://www.manning.com/ibsen/ Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus |
|
|
Re: AW: Problem with SOAP/JMS and transactionsHi 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 > <transacted/> to the route for the server. > > > > <beans xmlns="http://www.springframework.org/schema/beans" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xmlns:context="http://www.springframework.org/schema/context" > xsi:schemaLocation="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" > <context:annotation-config/> > > <import resource="classpath:META-INF/cxf/cxf.xml" /> > <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" /> > <import resource="classpath:META-INF/cxf/cxf-extension-camel.xml" /> > <import resource="classpath:serviceRuntimeContext.xml" /> > > <bean id="configProps" > > class="org.springframework.beans.factory.config.PropertyPlaceholderConfigure > r"> > <property name="locations"> > <list> > <value>classpath:jms.properties</value> > </list> > </property> > </bean> > > <!-- Make sure to read the best practices for design and > implementation before > developing a service for production use. > http://wissen.enbw.net/display/etgsoa/3+-+Design > http://wissen.enbw.net/display/etgsoa/4+-+Entwicklung > --> > <bean id="appModule" class="net.enbw.endur.AppModule"> > <property name="customerService" ref="customerService"/> > </bean> > > <bean id="serviceImpl" class="net.enbw.endur.ServiceImpl"> > </bean> > > <!-- SOA configs below --> > > <endpoint id="customerServiceEndpoint" > xmlns="http://cxf.apache.org/jaxws" > xmlns:service="http://examples.etg.services.enbw.net/" > serviceName="service:CustomerService" > endpointName="service:CustomerServiceEndpoint" > address="camel://direct:server" > implementor="#serviceImpl"> > <features> > <!-- Enables logging of SOAP messages. --> > <logging xmlns="http://cxf.apache.org/core" /> > </features> > </endpoint> > > <client id="customerService" xmlns="http://cxf.apache.org/jaxws" > xmlns:service="http://examples.etg.services.enbw.net/" > serviceName="service:CustomerService" > endpointName="service:CustomerServiceEndpoint" > > serviceClass="net.enbw.services.etg.examples.customerservice.CustomerService > V1" > address="camel://direct:client"> > <features> > <!-- Enables logging of SOAP messages. --> > <!-- logging xmlns="http://cxf.apache.org/core" /--> > </features> > </client> > > <camelContext id="camelContext" trace="false" > xmlns="http://camel.apache.org/schema/spring"> > <route> > <from uri="direct:client"/> > <to > uri="jms://queue.net.enbw.services.etg.examples.customerservice.CustomerServ > ice" /> > </route> > <route> > <from > uri="jms://queue.net.enbw.services.etg.examples.customerservice.CustomerServ > ice" /> > <transacted/> > <to uri="direct:server" /> > </route> > </camelContext> > > <!-- See http://camel.apache.org/jms.html --> > <bean id="jms" > class="org.apache.camel.component.jms.JmsComponent"> > <constructor-arg index="0"> > <ref bean="jmsConfiguration" /> > </constructor-arg> > <property name="connectionFactory" > ref="jmsConnectionFactory" /> > </bean> > <bean id="jmsConfiguration" > class="org.apache.camel.component.jms.JmsConfiguration"> > <property name="useMessageIDAsCorrelationID" value="true" /> > <property name="acknowledgementModeName" value="TRANSACTED" > /> > <property name="explicitQosEnabled" value="true" /> > <property name="receiveTimeout" > value="${jms.receiveTimeout}" /> > <property name="requestTimeout" > value="${jms.requestTimeout}" /> > <property name="recoveryInterval" > value="${jms.recoveryInterval}" /> > <property name="timeToLive" value="${jms.timeToLive}" /> > <property name="transacted" value="true" /> > <property name="transactedInOut" value="true" /> > <property name="transactionManager" > ref="jmsTransactionManager"/> > </bean> > > <bean id="jmsTransactionManager" > class="org.springframework.jms.connection.JmsTransactionManager"> > <property name="connectionFactory" > ref="jmsConnectionFactory" /> > </bean> > > <!-- See Tibco EMS documentation --> > <bean id="jmsConnectionFactory" > class="com.tibco.tibjms.TibjmsConnectionFactory"> > <property name="serverUrl" value="${jms.serverUrl}" /> > <property name="userName" value="${jms.userName}" /> > <property name="userPassword" value="${jms.userPassword}" /> > <property name="reconnAttemptCount" > value="${jms.reconnAttemptCount}" /> > <property name="reconnAttemptDelay" > value="${jms.reconnAttemptDelay}" /> > </bean> > > </beans> > |
|
|
AW: AW: Problem with SOAP/JMS and transactionsHi 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. 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@... Sitz der Gesellschaft: Karlsruhe Handelsregister: Amtsgericht Mannheim HRB 108550 Vorsitzender des Aufsichtsrats: Dr. Bernhard Beck Geschäftsführer: Jochen Adenau, Dr. Peter Krampf -----Ursprüngliche Nachricht----- Von: Willem Jiang [mailto:willem.jiang@...] Gesendet: Montag, 2. November 2009 14:27 An: users@... 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 > <transacted/> to the route for the server. > > > > <beans xmlns="http://www.springframework.org/schema/beans" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xmlns:context="http://www.springframework.org/schema/context" > xsi:schemaLocation="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" > <context:annotation-config/> > > <import resource="classpath:META-INF/cxf/cxf.xml" /> > <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" /> > <import resource="classpath:META-INF/cxf/cxf-extension-camel.xml" /> > <import resource="classpath:serviceRuntimeContext.xml" /> > > <bean id="configProps" > > > r"> > <property name="locations"> > <list> > <value>classpath:jms.properties</value> > </list> > </property> > </bean> > > <!-- Make sure to read the best practices for design and > implementation before > developing a service for production use. > http://wissen.enbw.net/display/etgsoa/3+-+Design > http://wissen.enbw.net/display/etgsoa/4+-+Entwicklung > --> > <bean id="appModule" class="net.enbw.endur.AppModule"> > <property name="customerService" ref="customerService"/> > </bean> > > <bean id="serviceImpl" class="net.enbw.endur.ServiceImpl"> > </bean> > > <!-- SOA configs below --> > > <endpoint id="customerServiceEndpoint" > xmlns="http://cxf.apache.org/jaxws" > xmlns:service="http://examples.etg.services.enbw.net/" > serviceName="service:CustomerService" > endpointName="service:CustomerServiceEndpoint" > address="camel://direct:server" > implementor="#serviceImpl"> > <features> > <!-- Enables logging of SOAP messages. --> > <logging xmlns="http://cxf.apache.org/core" /> > </features> > </endpoint> > > <client id="customerService" xmlns="http://cxf.apache.org/jaxws" > xmlns:service="http://examples.etg.services.enbw.net/" > serviceName="service:CustomerService" > endpointName="service:CustomerServiceEndpoint" > > > V1" > address="camel://direct:client"> > <features> > <!-- Enables logging of SOAP messages. --> > <!-- logging xmlns="http://cxf.apache.org/core" /--> > </features> > </client> > > <camelContext id="camelContext" trace="false" > xmlns="http://camel.apache.org/schema/spring"> > <route> > <from uri="direct:client"/> > <to > > ice" /> > </route> > <route> > <from > uri="jms://queue.net.enbw.services.etg.examples.customerservice.CustomerServ > ice" /> > <transacted/> > <to uri="direct:server" /> > </route> > </camelContext> > > <!-- See http://camel.apache.org/jms.html --> > <bean id="jms" > class="org.apache.camel.component.jms.JmsComponent"> > <constructor-arg index="0"> > <ref bean="jmsConfiguration" /> > </constructor-arg> > <property name="connectionFactory" > ref="jmsConnectionFactory" /> > </bean> > <bean id="jmsConfiguration" > class="org.apache.camel.component.jms.JmsConfiguration"> > <property name="useMessageIDAsCorrelationID" value="true" /> > <property name="acknowledgementModeName" value="TRANSACTED" > /> > <property name="explicitQosEnabled" value="true" /> > <property name="receiveTimeout" > value="${jms.receiveTimeout}" /> > <property name="requestTimeout" > value="${jms.requestTimeout}" /> > <property name="recoveryInterval" > value="${jms.recoveryInterval}" /> > <property name="timeToLive" value="${jms.timeToLive}" /> > <property name="transacted" value="true" /> > <property name="transactedInOut" value="true" /> > <property name="transactionManager" > ref="jmsTransactionManager"/> > </bean> > > <bean id="jmsTransactionManager" > class="org.springframework.jms.connection.JmsTransactionManager"> > <property name="connectionFactory" > ref="jmsConnectionFactory" /> > </bean> > > <!-- See Tibco EMS documentation --> > <bean id="jmsConnectionFactory" > class="com.tibco.tibjms.TibjmsConnectionFactory"> > <property name="serverUrl" value="${jms.serverUrl}" /> > <property name="userName" value="${jms.userName}" /> > <property name="userPassword" value="${jms.userPassword}" /> > <property name="reconnAttemptCount" > value="${jms.reconnAttemptCount}" /> > <property name="reconnAttemptDelay" > value="${jms.reconnAttemptDelay}" /> > </bean> > > </beans> > |
|
|
Re: AW: Problem with SOAP/JMS and transactionsOn Mon, Nov 2, 2009 at 2:47 PM, Schneider Christian
<Christian.Schneider@...> 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@... > > Sitz der Gesellschaft: Karlsruhe > Handelsregister: Amtsgericht Mannheim HRB 108550 > Vorsitzender des Aufsichtsrats: Dr. Bernhard Beck > Geschäftsführer: Jochen Adenau, Dr. Peter Krampf > > -----Ursprüngliche Nachricht----- > Von: Willem Jiang [mailto:willem.jiang@...] > Gesendet: Montag, 2. November 2009 14:27 > An: users@... > 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 >> <transacted/> to the route for the server. >> >> >> >> <beans xmlns="http://www.springframework.org/schema/beans" >> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >> xmlns:context="http://www.springframework.org/schema/context" >> xsi:schemaLocation="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" >> <context:annotation-config/> >> >> <import resource="classpath:META-INF/cxf/cxf.xml" /> >> <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" /> >> <import resource="classpath:META-INF/cxf/cxf-extension-camel.xml" /> >> <import resource="classpath:serviceRuntimeContext.xml" /> >> >> <bean id="configProps" >> >> > class="org.springframework.beans.factory.config.PropertyPlaceholderConfigure >> r"> >> <property name="locations"> >> <list> >> <value>classpath:jms.properties</value> >> </list> >> </property> >> </bean> >> >> <!-- Make sure to read the best practices for design and >> implementation before >> developing a service for production use. >> http://wissen.enbw.net/display/etgsoa/3+-+Design >> http://wissen.enbw.net/display/etgsoa/4+-+Entwicklung >> --> >> <bean id="appModule" class="net.enbw.endur.AppModule"> >> <property name="customerService" ref="customerService"/> >> </bean> >> >> <bean id="serviceImpl" class="net.enbw.endur.ServiceImpl"> >> </bean> >> >> <!-- SOA configs below --> >> >> <endpoint id="customerServiceEndpoint" >> xmlns="http://cxf.apache.org/jaxws" >> xmlns:service="http://examples.etg.services.enbw.net/" >> serviceName="service:CustomerService" >> endpointName="service:CustomerServiceEndpoint" >> address="camel://direct:server" >> implementor="#serviceImpl"> >> <features> >> <!-- Enables logging of SOAP messages. --> >> <logging xmlns="http://cxf.apache.org/core" /> >> </features> >> </endpoint> >> >> <client id="customerService" xmlns="http://cxf.apache.org/jaxws" >> xmlns:service="http://examples.etg.services.enbw.net/" >> serviceName="service:CustomerService" >> endpointName="service:CustomerServiceEndpoint" >> >> > serviceClass="net.enbw.services.etg.examples.customerservice.CustomerService >> V1" >> address="camel://direct:client"> >> <features> >> <!-- Enables logging of SOAP messages. --> >> <!-- logging xmlns="http://cxf.apache.org/core" /--> >> </features> >> </client> >> >> <camelContext id="camelContext" trace="false" >> xmlns="http://camel.apache.org/schema/spring"> >> <route> >> <from uri="direct:client"/> >> <to >> > uri="jms://queue.net.enbw.services.etg.examples.customerservice.CustomerServ >> ice" /> >> </route> >> <route> >> <from >> > uri="jms://queue.net.enbw.services.etg.examples.customerservice.CustomerServ >> ice" /> >> <transacted/> >> <to uri="direct:server" /> >> </route> >> </camelContext> >> >> <!-- See http://camel.apache.org/jms.html --> >> <bean id="jms" >> class="org.apache.camel.component.jms.JmsComponent"> >> <constructor-arg index="0"> >> <ref bean="jmsConfiguration" /> >> </constructor-arg> >> <property name="connectionFactory" >> ref="jmsConnectionFactory" /> >> </bean> >> <bean id="jmsConfiguration" >> class="org.apache.camel.component.jms.JmsConfiguration"> >> <property name="useMessageIDAsCorrelationID" value="true" /> >> <property name="acknowledgementModeName" value="TRANSACTED" >> /> >> <property name="explicitQosEnabled" value="true" /> >> <property name="receiveTimeout" >> value="${jms.receiveTimeout}" /> >> <property name="requestTimeout" >> value="${jms.requestTimeout}" /> >> <property name="recoveryInterval" >> value="${jms.recoveryInterval}" /> >> <property name="timeToLive" value="${jms.timeToLive}" /> >> <property name="transacted" value="true" /> >> <property name="transactedInOut" value="true" /> >> <property name="transactionManager" >> ref="jmsTransactionManager"/> >> </bean> >> >> <bean id="jmsTransactionManager" >> class="org.springframework.jms.connection.JmsTransactionManager"> >> <property name="connectionFactory" >> ref="jmsConnectionFactory" /> >> </bean> >> >> <!-- See Tibco EMS documentation --> >> <bean id="jmsConnectionFactory" >> class="com.tibco.tibjms.TibjmsConnectionFactory"> >> <property name="serverUrl" value="${jms.serverUrl}" /> >> <property name="userName" value="${jms.userName}" /> >> <property name="userPassword" value="${jms.userPassword}" /> >> <property name="reconnAttemptCount" >> value="${jms.reconnAttemptCount}" /> >> <property name="reconnAttemptDelay" >> value="${jms.reconnAttemptDelay}" /> >> </bean> >> >> </beans> >> > > -- Claus Ibsen Apache Camel Committer Author of Camel in Action: http://www.manning.com/ibsen/ Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus |
|
|
AW: AW: Problem with SOAP/JMS and transactionsHi Claus,
I have replaced the cxf server with the folowing route: <route> <from uri="jms://queue.net.enbw.services.etg.examples.customerservice.CustomerServ ice" /> <transacted/> <to uri="serviceImplProc"/> </route> 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. Thanks already for your help 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@... Sitz der Gesellschaft: Karlsruhe Handelsregister: Amtsgericht Mannheim HRB 108550 Vorsitzender des Aufsichtsrats: Dr. Bernhard Beck Geschäftsführer: Jochen Adenau, Dr. Peter Krampf -----Ursprüngliche Nachricht----- Von: Claus Ibsen [mailto:claus.ibsen@...] Gesendet: Montag, 2. November 2009 14:56 An: users@... Betreff: Re: AW: Problem with SOAP/JMS and transactions On Mon, Nov 2, 2009 at 2:47 PM, Schneider Christian <Christian.Schneider@...> 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@... > > Sitz der Gesellschaft: Karlsruhe > Handelsregister: Amtsgericht Mannheim HRB 108550 > Vorsitzender des Aufsichtsrats: Dr. Bernhard Beck > Geschäftsführer: Jochen Adenau, Dr. Peter Krampf > > -----Ursprüngliche Nachricht----- > Von: Willem Jiang [mailto:willem.jiang@...] > Gesendet: Montag, 2. November 2009 14:27 > An: users@... > 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 >> <transacted/> to the route for the server. >> >> >> >> <beans xmlns="http://www.springframework.org/schema/beans" >> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >> xmlns:context="http://www.springframework.org/schema/context" >> xsi:schemaLocation="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" >> <context:annotation-config/> >> >> <import resource="classpath:META-INF/cxf/cxf.xml" /> >> <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" /> >> <import resource="classpath:META-INF/cxf/cxf-extension-camel.xml" >> <import resource="classpath:serviceRuntimeContext.xml" /> >> >> <bean id="configProps" >> >> > class="org.springframework.beans.factory.config.PropertyPlaceholderConfigure >> r"> >> <property name="locations"> >> <list> >> <value>classpath:jms.properties</value> >> </list> >> </property> >> </bean> >> >> <!-- Make sure to read the best practices for design and >> implementation before >> developing a service for production use. >> http://wissen.enbw.net/display/etgsoa/3+-+Design >> http://wissen.enbw.net/display/etgsoa/4+-+Entwicklung >> --> >> <bean id="appModule" class="net.enbw.endur.AppModule"> >> <property name="customerService" ref="customerService"/> >> </bean> >> >> <bean id="serviceImpl" class="net.enbw.endur.ServiceImpl"> >> </bean> >> >> <!-- SOA configs below --> >> >> <endpoint id="customerServiceEndpoint" >> xmlns="http://cxf.apache.org/jaxws" >> xmlns:service="http://examples.etg.services.enbw.net/" >> serviceName="service:CustomerService" >> endpointName="service:CustomerServiceEndpoint" >> address="camel://direct:server" >> implementor="#serviceImpl"> >> <features> >> <!-- Enables logging of SOAP messages. --> >> <logging xmlns="http://cxf.apache.org/core" /> >> </features> >> </endpoint> >> >> <client id="customerService" xmlns="http://cxf.apache.org/jaxws" >> xmlns:service="http://examples.etg.services.enbw.net/" >> serviceName="service:CustomerService" >> endpointName="service:CustomerServiceEndpoint" >> >> > >> V1" >> address="camel://direct:client"> >> <features> >> <!-- Enables logging of SOAP messages. --> >> <!-- logging xmlns="http://cxf.apache.org/core" /--> >> </features> >> </client> >> >> <camelContext id="camelContext" trace="false" >> xmlns="http://camel.apache.org/schema/spring"> >> <route> >> <from uri="direct:client"/> >> <to >> > >> ice" /> >> </route> >> <route> >> <from >> > uri="jms://queue.net.enbw.services.etg.examples.customerservice.CustomerServ >> ice" /> >> <transacted/> >> <to uri="direct:server" /> >> </route> >> </camelContext> >> >> <!-- See http://camel.apache.org/jms.html --> >> <bean id="jms" >> class="org.apache.camel.component.jms.JmsComponent"> >> <constructor-arg index="0"> >> <ref bean="jmsConfiguration" /> >> </constructor-arg> >> <property name="connectionFactory" >> ref="jmsConnectionFactory" /> >> </bean> >> <bean id="jmsConfiguration" >> class="org.apache.camel.component.jms.JmsConfiguration"> >> <property name="useMessageIDAsCorrelationID" value="true" >> <property name="acknowledgementModeName" value="TRANSACTED" >> /> >> <property name="explicitQosEnabled" value="true" /> >> <property name="receiveTimeout" >> value="${jms.receiveTimeout}" /> >> <property name="requestTimeout" >> value="${jms.requestTimeout}" /> >> <property name="recoveryInterval" >> value="${jms.recoveryInterval}" /> >> <property name="timeToLive" value="${jms.timeToLive}" /> >> <property name="transacted" value="true" /> >> <property name="transactedInOut" value="true" /> >> <property name="transactionManager" >> ref="jmsTransactionManager"/> >> </bean> >> >> <bean id="jmsTransactionManager" >> class="org.springframework.jms.connection.JmsTransactionManager"> >> <property name="connectionFactory" >> ref="jmsConnectionFactory" /> >> </bean> >> >> <!-- See Tibco EMS documentation --> >> <bean id="jmsConnectionFactory" >> class="com.tibco.tibjms.TibjmsConnectionFactory"> >> <property name="serverUrl" value="${jms.serverUrl}" /> >> <property name="userName" value="${jms.userName}" /> >> <property name="userPassword" value="${jms.userPassword}" >> <property name="reconnAttemptCount" >> value="${jms.reconnAttemptCount}" /> >> <property name="reconnAttemptDelay" >> value="${jms.reconnAttemptDelay}" /> >> </bean> >> >> </beans> >> > > -- Claus Ibsen Apache Camel Committer Author of Camel in Action: http://www.manning.com/ibsen/ Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus |
|
|
Re: AW: AW: Problem with SOAP/JMS and transactionsHi Christian,
I'm glade it works on camel side. For the CXF side , I think we need to check the CXF message's exception in the Camel transport and let camel throw the exception. Here is my patch on the latest trunk code (not be verified yet), please feel free to give it a try. ### Eclipse Workspace Patch 1.0 #P camel-cxf Index: src/main/java/org/apache/camel/component/cxf/transport/CamelDestination.java =================================================================== --- src/main/java/org/apache/camel/component/cxf/transport/CamelDestination.java (revision 831871) +++ src/main/java/org/apache/camel/component/cxf/transport/CamelDestination.java (working copy) @@ -271,6 +271,12 @@ propagateResponseHeadersToCamel(outMessage, camelExchange); + // check if the outMessage has an exception + Exception exception = outMessage.getContent(Exception.class); + if (exception != null) { + camelExchange.setException(exception); + } + CachedOutputStream outputStream = (CachedOutputStream)outMessage.getContent(OutputStream.class); camelExchange.getOut().setBody(outputStream.getBytes()); getLogger().log(Level.FINE, "send the response message: " + outputStream); Schneider Christian wrote: > Hi Claus, > > I have replaced the cxf server with the folowing route: > <route> > <from > uri="jms://queue.net.enbw.services.etg.examples.customerservice.CustomerServ > ice" /> > <transacted/> > <to uri="serviceImplProc"/> > </route> > > 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. > > Thanks already for your help > > 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@... > > Sitz der Gesellschaft: Karlsruhe > Handelsregister: Amtsgericht Mannheim HRB 108550 > Vorsitzender des Aufsichtsrats: Dr. Bernhard Beck > Geschäftsführer: Jochen Adenau, Dr. Peter Krampf > > -----Ursprüngliche Nachricht----- > Von: Claus Ibsen [mailto:claus.ibsen@...] > Gesendet: Montag, 2. November 2009 14:56 > An: users@... > Betreff: Re: AW: Problem with SOAP/JMS and transactions > > On Mon, Nov 2, 2009 at 2:47 PM, Schneider Christian > <Christian.Schneider@...> 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@... >> >> Sitz der Gesellschaft: Karlsruhe >> Handelsregister: Amtsgericht Mannheim HRB 108550 >> Vorsitzender des Aufsichtsrats: Dr. Bernhard Beck >> Geschäftsführer: Jochen Adenau, Dr. Peter Krampf >> >> -----Ursprüngliche Nachricht----- >> Von: Willem Jiang [mailto:willem.jiang@...] >> Gesendet: Montag, 2. November 2009 14:27 >> An: users@... >> 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 >>> <transacted/> to the route for the server. >>> >>> >>> >>> <beans xmlns="http://www.springframework.org/schema/beans" >>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >>> xmlns:context="http://www.springframework.org/schema/context" >>> xsi:schemaLocation="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" >>> <context:annotation-config/> >>> >>> <import resource="classpath:META-INF/cxf/cxf.xml" /> >>> <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" /> >>> <import resource="classpath:META-INF/cxf/cxf-extension-camel.xml" > /> >>> <import resource="classpath:serviceRuntimeContext.xml" /> >>> >>> <bean id="configProps" >>> >>> > class="org.springframework.beans.factory.config.PropertyPlaceholderConfigure >>> r"> >>> <property name="locations"> >>> <list> >>> <value>classpath:jms.properties</value> >>> </list> >>> </property> >>> </bean> >>> >>> <!-- Make sure to read the best practices for design and >>> implementation before >>> developing a service for production use. >>> http://wissen.enbw.net/display/etgsoa/3+-+Design >>> http://wissen.enbw.net/display/etgsoa/4+-+Entwicklung >>> --> >>> <bean id="appModule" class="net.enbw.endur.AppModule"> >>> <property name="customerService" ref="customerService"/> >>> </bean> >>> >>> <bean id="serviceImpl" class="net.enbw.endur.ServiceImpl"> >>> </bean> >>> >>> <!-- SOA configs below --> >>> >>> <endpoint id="customerServiceEndpoint" >>> xmlns="http://cxf.apache.org/jaxws" >>> xmlns:service="http://examples.etg.services.enbw.net/" >>> serviceName="service:CustomerService" >>> endpointName="service:CustomerServiceEndpoint" >>> address="camel://direct:server" >>> implementor="#serviceImpl"> >>> <features> >>> <!-- Enables logging of SOAP messages. --> >>> <logging xmlns="http://cxf.apache.org/core" /> >>> </features> >>> </endpoint> >>> >>> <client id="customerService" xmlns="http://cxf.apache.org/jaxws" >>> xmlns:service="http://examples.etg.services.enbw.net/" >>> serviceName="service:CustomerService" >>> endpointName="service:CustomerServiceEndpoint" >>> >>> > serviceClass="net.enbw.services.etg.examples.customerservice.CustomerService >>> V1" >>> address="camel://direct:client"> >>> <features> >>> <!-- Enables logging of SOAP messages. --> >>> <!-- logging xmlns="http://cxf.apache.org/core" > /--> >>> </features> >>> </client> >>> >>> <camelContext id="camelContext" trace="false" >>> xmlns="http://camel.apache.org/schema/spring"> >>> <route> >>> <from uri="direct:client"/> >>> <to >>> > uri="jms://queue.net.enbw.services.etg.examples.customerservice.CustomerServ >>> ice" /> >>> </route> >>> <route> >>> <from >>> > uri="jms://queue.net.enbw.services.etg.examples.customerservice.CustomerServ >>> ice" /> >>> <transacted/> >>> <to uri="direct:server" /> >>> </route> >>> </camelContext> >>> >>> <!-- See http://camel.apache.org/jms.html --> >>> <bean id="jms" >>> class="org.apache.camel.component.jms.JmsComponent"> >>> <constructor-arg index="0"> >>> <ref bean="jmsConfiguration" /> >>> </constructor-arg> >>> <property name="connectionFactory" >>> ref="jmsConnectionFactory" /> >>> </bean> >>> <bean id="jmsConfiguration" >>> class="org.apache.camel.component.jms.JmsConfiguration"> >>> <property name="useMessageIDAsCorrelationID" value="true" > /> >>> <property name="acknowledgementModeName" value="TRANSACTED" >>> /> >>> <property name="explicitQosEnabled" value="true" /> >>> <property name="receiveTimeout" >>> value="${jms.receiveTimeout}" /> >>> <property name="requestTimeout" >>> value="${jms.requestTimeout}" /> >>> <property name="recoveryInterval" >>> value="${jms.recoveryInterval}" /> >>> <property name="timeToLive" value="${jms.timeToLive}" /> >>> <property name="transacted" value="true" /> >>> <property name="transactedInOut" value="true" /> >>> <property name="transactionManager" >>> ref="jmsTransactionManager"/> >>> </bean> >>> >>> <bean id="jmsTransactionManager" >>> class="org.springframework.jms.connection.JmsTransactionManager"> >>> <property name="connectionFactory" >>> ref="jmsConnectionFactory" /> >>> </bean> >>> >>> <!-- See Tibco EMS documentation --> >>> <bean id="jmsConnectionFactory" >>> class="com.tibco.tibjms.TibjmsConnectionFactory"> >>> <property name="serverUrl" value="${jms.serverUrl}" /> >>> <property name="userName" value="${jms.userName}" /> >>> <property name="userPassword" value="${jms.userPassword}" > /> >>> <property name="reconnAttemptCount" >>> value="${jms.reconnAttemptCount}" /> >>> <property name="reconnAttemptDelay" >>> value="${jms.reconnAttemptDelay}" /> >>> </bean> >>> >>> </beans> >>> >> > > > |
|
|
AW: AW: AW: Problem with SOAP/JMS and transactionsHi 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 Business Solutions Handel und Dispatching Durlacher Allee 93 76131 Karlsruhe Tel : +49-(0)721-63-15482 Mail: christian.schneider@... Sitz der Gesellschaft: Karlsruhe Handelsregister: Amtsgericht Mannheim HRB 108550 Vorsitzender des Aufsichtsrats: Dr. Bernhard Beck Geschäftsführer: Jochen Adenau, Dr. Peter Krampf -----Ursprüngliche Nachricht----- Von: Willem Jiang [mailto:willem.jiang@...] Gesendet: Montag, 2. November 2009 15:40 An: users@... 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 in the Camel transport and let camel throw the exception. Here is my patch on the latest trunk code (not be verified yet), please feel free to give it a try. ### Eclipse Workspace Patch 1.0 #P camel-cxf Index: src/main/java/org/apache/camel/component/cxf/transport/CamelDestination.java =================================================================== --- src/main/java/org/apache/camel/component/cxf/transport/CamelDestination.java (revision 831871) +++ src/main/java/org/apache/camel/component/cxf/transport/CamelDestination.java (working copy) @@ -271,6 +271,12 @@ propagateResponseHeadersToCamel(outMessage, camelExchange); + // check if the outMessage has an exception + Exception exception = outMessage.getContent(Exception.class); + if (exception != null) { + camelExchange.setException(exception); + } + CachedOutputStream outputStream = (CachedOutputStream)outMessage.getContent(OutputStream.class); camelExchange.getOut().setBody(outputStream.getBytes()); getLogger().log(Level.FINE, "send the response message: " + outputStream); Schneider Christian wrote: > Hi Claus, > > I have replaced the cxf server with the folowing route: > <route> > <from > uri="jms://queue.net.enbw.services.etg.examples.customerservice.CustomerServ > ice" /> > <transacted/> > <to uri="serviceImplProc"/> > </route> > > 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. > > Thanks already for your help > > 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@... > > Sitz der Gesellschaft: Karlsruhe > Handelsregister: Amtsgericht Mannheim HRB 108550 > Vorsitzender des Aufsichtsrats: Dr. Bernhard Beck > Geschäftsführer: Jochen Adenau, Dr. Peter Krampf > > -----Ursprüngliche Nachricht----- > Von: Claus Ibsen [mailto:claus.ibsen@...] > Gesendet: Montag, 2. November 2009 14:56 > An: users@... > Betreff: Re: AW: Problem with SOAP/JMS and transactions > > On Mon, Nov 2, 2009 at 2:47 PM, Schneider Christian > <Christian.Schneider@...> 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@... >> >> Sitz der Gesellschaft: Karlsruhe >> Handelsregister: Amtsgericht Mannheim HRB 108550 >> Vorsitzender des Aufsichtsrats: Dr. Bernhard Beck >> Geschäftsführer: Jochen Adenau, Dr. Peter Krampf >> >> -----Ursprüngliche Nachricht----- >> Von: Willem Jiang [mailto:willem.jiang@...] >> Gesendet: Montag, 2. November 2009 14:27 >> An: users@... >> 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 >>> <transacted/> to the route for the server. >>> >>> >>> >>> <beans xmlns="http://www.springframework.org/schema/beans" >>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >>> xmlns:context="http://www.springframework.org/schema/context" >>> xsi:schemaLocation="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" >>> <context:annotation-config/> >>> >>> <import resource="classpath:META-INF/cxf/cxf.xml" /> >>> <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" >>> <import resource="classpath:META-INF/cxf/cxf-extension-camel.xml" > /> >>> <import resource="classpath:serviceRuntimeContext.xml" /> >>> >>> <bean id="configProps" >>> >>> > class="org.springframework.beans.factory.config.PropertyPlaceholderConfigure >>> r"> >>> <property name="locations"> >>> <list> >>> <value>classpath:jms.properties</value> >>> </list> >>> </property> >>> </bean> >>> >>> <!-- Make sure to read the best practices for design and >>> implementation before >>> developing a service for production use. >>> http://wissen.enbw.net/display/etgsoa/3+-+Design >>> http://wissen.enbw.net/display/etgsoa/4+-+Entwicklung >>> --> >>> <bean id="appModule" class="net.enbw.endur.AppModule"> >>> <property name="customerService" ref="customerService"/> >>> </bean> >>> >>> <bean id="serviceImpl" class="net.enbw.endur.ServiceImpl"> >>> </bean> >>> >>> <!-- SOA configs below --> >>> >>> <endpoint id="customerServiceEndpoint" >>> xmlns="http://cxf.apache.org/jaxws" >>> xmlns:service="http://examples.etg.services.enbw.net/" >>> serviceName="service:CustomerService" >>> endpointName="service:CustomerServiceEndpoint" >>> address="camel://direct:server" >>> implementor="#serviceImpl"> >>> <features> >>> <!-- Enables logging of SOAP messages. --> >>> <logging xmlns="http://cxf.apache.org/core" /> >>> </features> >>> </endpoint> >>> >>> <client id="customerService" xmlns="http://cxf.apache.org/jaxws" >>> xmlns:service="http://examples.etg.services.enbw.net/" >>> serviceName="service:CustomerService" >>> endpointName="service:CustomerServiceEndpoint" >>> >>> > >>> V1" >>> address="camel://direct:client"> >>> <features> >>> <!-- Enables logging of SOAP messages. --> >>> <!-- logging xmlns="http://cxf.apache.org/core" > /--> >>> </features> >>> </client> >>> >>> <camelContext id="camelContext" trace="false" >>> xmlns="http://camel.apache.org/schema/spring"> >>> <route> >>> <from uri="direct:client"/> >>> <to >>> > >>> ice" /> >>> </route> >>> <route> >>> <from >>> > uri="jms://queue.net.enbw.services.etg.examples.customerservice.CustomerServ >>> ice" /> >>> <transacted/> >>> <to uri="direct:server" /> >>> </route> >>> </camelContext> >>> >>> <!-- See http://camel.apache.org/jms.html --> >>> <bean id="jms" >>> class="org.apache.camel.component.jms.JmsComponent"> >>> <constructor-arg index="0"> >>> <ref bean="jmsConfiguration" /> >>> </constructor-arg> >>> <property name="connectionFactory" >>> ref="jmsConnectionFactory" /> >>> </bean> >>> <bean id="jmsConfiguration" >>> class="org.apache.camel.component.jms.JmsConfiguration"> >>> <property name="useMessageIDAsCorrelationID" value="true" > /> >>> <property name="acknowledgementModeName" >>> /> >>> <property name="explicitQosEnabled" value="true" /> >>> <property name="receiveTimeout" >>> value="${jms.receiveTimeout}" /> >>> <property name="requestTimeout" >>> value="${jms.requestTimeout}" /> >>> <property name="recoveryInterval" >>> value="${jms.recoveryInterval}" /> >>> <property name="timeToLive" value="${jms.timeToLive}" /> >>> <property name="transacted" value="true" /> >>> <property name="transactedInOut" value="true" /> >>> <property name="transactionManager" >>> ref="jmsTransactionManager"/> >>> </bean> >>> >>> <bean id="jmsTransactionManager" >>> class="org.springframework.jms.connection.JmsTransactionManager"> >>> <property name="connectionFactory" >>> ref="jmsConnectionFactory" /> >>> </bean> >>> >>> <!-- See Tibco EMS documentation --> >>> <bean id="jmsConnectionFactory" >>> class="com.tibco.tibjms.TibjmsConnectionFactory"> >>> <property name="serverUrl" value="${jms.serverUrl}" /> >>> <property name="userName" value="${jms.userName}" /> >>> <property name="userPassword" value="${jms.userPassword}" > /> >>> <property name="reconnAttemptCount" >>> value="${jms.reconnAttemptCount}" /> >>> <property name="reconnAttemptDelay" >>> value="${jms.reconnAttemptDelay}" /> >>> </bean> >>> >>> </beans> >>> >> > > > |
|
|
AW: AW: AW: Problem with SOAP/JMS and transactionsHi Willem,
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. In the meantime I will try to use a onException() clause to do this differentiation. I have also created a jira issue for the whole problem. https://issues.apache.org/activemq/browse/CAMEL-2128 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@... Sitz der Gesellschaft: Karlsruhe Handelsregister: Amtsgericht Mannheim HRB 108550 Vorsitzender des Aufsichtsrats: Dr. Bernhard Beck Geschäftsführer: Jochen Adenau, Dr. Peter Krampf -----Ursprüngliche Nachricht----- Von: Willem Jiang [mailto:willem.jiang@...] Gesendet: Montag, 2. November 2009 15:40 An: users@... 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 in the Camel transport and let camel throw the exception. Here is my patch on the latest trunk code (not be verified yet), please feel free to give it a try. ### Eclipse Workspace Patch 1.0 #P camel-cxf Index: src/main/java/org/apache/camel/component/cxf/transport/CamelDestination.java =================================================================== --- src/main/java/org/apache/camel/component/cxf/transport/CamelDestination.java (revision 831871) +++ src/main/java/org/apache/camel/component/cxf/transport/CamelDestination.java (working copy) @@ -271,6 +271,12 @@ propagateResponseHeadersToCamel(outMessage, camelExchange); + // check if the outMessage has an exception + Exception exception = outMessage.getContent(Exception.class); + if (exception != null) { + camelExchange.setException(exception); + } + CachedOutputStream outputStream = (CachedOutputStream)outMessage.getContent(OutputStream.class); camelExchange.getOut().setBody(outputStream.getBytes()); getLogger().log(Level.FINE, "send the response message: " + outputStream); Schneider Christian wrote: > Hi Claus, > > I have replaced the cxf server with the folowing route: > <route> > <from > uri="jms://queue.net.enbw.services.etg.examples.customerservice.CustomerServ > ice" /> > <transacted/> > <to uri="serviceImplProc"/> > </route> > > 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. > > Thanks already for your help > > 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@... > > Sitz der Gesellschaft: Karlsruhe > Handelsregister: Amtsgericht Mannheim HRB 108550 > Vorsitzender des Aufsichtsrats: Dr. Bernhard Beck > Geschäftsführer: Jochen Adenau, Dr. Peter Krampf > > -----Ursprüngliche Nachricht----- > Von: Claus Ibsen [mailto:claus.ibsen@...] > Gesendet: Montag, 2. November 2009 14:56 > An: users@... > Betreff: Re: AW: Problem with SOAP/JMS and transactions > > On Mon, Nov 2, 2009 at 2:47 PM, Schneider Christian > <Christian.Schneider@...> 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@... >> >> Sitz der Gesellschaft: Karlsruhe >> Handelsregister: Amtsgericht Mannheim HRB 108550 >> Vorsitzender des Aufsichtsrats: Dr. Bernhard Beck >> Geschäftsführer: Jochen Adenau, Dr. Peter Krampf >> >> -----Ursprüngliche Nachricht----- >> Von: Willem Jiang [mailto:willem.jiang@...] >> Gesendet: Montag, 2. November 2009 14:27 >> An: users@... >> 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 >>> <transacted/> to the route for the server. >>> >>> >>> >>> <beans xmlns="http://www.springframework.org/schema/beans" >>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >>> xmlns:context="http://www.springframework.org/schema/context" >>> xsi:schemaLocation="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" >>> <context:annotation-config/> >>> >>> <import resource="classpath:META-INF/cxf/cxf.xml" /> >>> <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" >>> <import resource="classpath:META-INF/cxf/cxf-extension-camel.xml" > /> >>> <import resource="classpath:serviceRuntimeContext.xml" /> >>> >>> <bean id="configProps" >>> >>> > class="org.springframework.beans.factory.config.PropertyPlaceholderConfigure >>> r"> >>> <property name="locations"> >>> <list> >>> <value>classpath:jms.properties</value> >>> </list> >>> </property> >>> </bean> >>> >>> <!-- Make sure to read the best practices for design and >>> implementation before >>> developing a service for production use. >>> http://wissen.enbw.net/display/etgsoa/3+-+Design >>> http://wissen.enbw.net/display/etgsoa/4+-+Entwicklung >>> --> >>> <bean id="appModule" class="net.enbw.endur.AppModule"> >>> <property name="customerService" ref="customerService"/> >>> </bean> >>> >>> <bean id="serviceImpl" class="net.enbw.endur.ServiceImpl"> >>> </bean> >>> >>> <!-- SOA configs below --> >>> >>> <endpoint id="customerServiceEndpoint" >>> xmlns="http://cxf.apache.org/jaxws" >>> xmlns:service="http://examples.etg.services.enbw.net/" >>> serviceName="service:CustomerService" >>> endpointName="service:CustomerServiceEndpoint" >>> address="camel://direct:server" >>> implementor="#serviceImpl"> >>> <features> >>> <!-- Enables logging of SOAP messages. --> >>> <logging xmlns="http://cxf.apache.org/core" /> >>> </features> >>> </endpoint> >>> >>> <client id="customerService" xmlns="http://cxf.apache.org/jaxws" >>> xmlns:service="http://examples.etg.services.enbw.net/" >>> serviceName="service:CustomerService" >>> endpointName="service:CustomerServiceEndpoint" >>> >>> > >>> V1" >>> address="camel://direct:client"> >>> <features> >>> <!-- Enables logging of SOAP messages. --> >>> <!-- logging xmlns="http://cxf.apache.org/core" > /--> >>> </features> >>> </client> >>> >>> <camelContext id="camelContext" trace="false" >>> xmlns="http://camel.apache.org/schema/spring"> >>> <route> >>> <from uri="direct:client"/> >>> <to >>> > >>> ice" /> >>> </route> >>> <route> >>> <from >>> > uri="jms://queue.net.enbw.services.etg.examples.customerservice.CustomerServ >>> ice" /> >>> <transacted/> >>> <to uri="direct:server" /> >>> </route> >>> </camelContext> >>> >>> <!-- See http://camel.apache.org/jms.html --> >>> <bean id="jms" >>> class="org.apache.camel.component.jms.JmsComponent"> >>> <constructor-arg index="0"> >>> <ref bean="jmsConfiguration" /> >>> </constructor-arg> >>> <property name="connectionFactory" >>> ref="jmsConnectionFactory" /> >>> </bean> >>> <bean id="jmsConfiguration" >>> class="org.apache.camel.component.jms.JmsConfiguration"> >>> <property name="useMessageIDAsCorrelationID" value="true" > /> >>> <property name="acknowledgementModeName" >>> /> >>> <property name="explicitQosEnabled" value="true" /> >>> <property name="receiveTimeout" >>> value="${jms.receiveTimeout}" /> >>> <property name="requestTimeout" >>> value="${jms.requestTimeout}" /> >>> <property name="recoveryInterval" >>> value="${jms.recoveryInterval}" /> >>> <property name="timeToLive" value="${jms.timeToLive}" /> >>> <property name="transacted" value="true" /> >>> <property name="transactedInOut" value="true" /> >>> <property name="transactionManager" >>> ref="jmsTransactionManager"/> >>> </bean> >>> >>> <bean id="jmsTransactionManager" >>> class="org.springframework.jms.connection.JmsTransactionManager"> >>> <property name="connectionFactory" >>> ref="jmsConnectionFactory" /> >>> </bean> >>> >>> <!-- See Tibco EMS documentation --> >>> <bean id="jmsConnectionFactory" >>> class="com.tibco.tibjms.TibjmsConnectionFactory"> >>> <property name="serverUrl" value="${jms.serverUrl}" /> >>> <property name="userName" value="${jms.userName}" /> >>> <property name="userPassword" value="${jms.userPassword}" > /> >>> <property name="reconnAttemptCount" >>> value="${jms.reconnAttemptCount}" /> >>> <property name="reconnAttemptDelay" >>> value="${jms.reconnAttemptDelay}" /> >>> </bean> >>> >>> </beans> >>> >> > > > |
|
|
Re: AW: AW: AW: Problem with SOAP/JMS and transactionsHi Christian,
I saw the issue and submitted a patch for it. BTW, I think onException is a good way to resolve your customer exception issue. Willem Schneider Christian wrote: > Hi Willem, > > 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. > > In the meantime I will try to use a onException() clause to do this > differentiation. > > I have also created a jira issue for the whole problem. > https://issues.apache.org/activemq/browse/CAMEL-2128 > > > 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@... > > Sitz der Gesellschaft: Karlsruhe > Handelsregister: Amtsgericht Mannheim HRB 108550 > Vorsitzender des Aufsichtsrats: Dr. Bernhard Beck > Geschäftsführer: Jochen Adenau, Dr. Peter Krampf > > -----Ursprüngliche Nachricht----- > Von: Willem Jiang [mailto:willem.jiang@...] > Gesendet: Montag, 2. November 2009 15:40 > An: users@... > 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 > in the Camel transport and let camel throw the exception. > > Here is my patch on the latest trunk code (not be verified yet), please > feel free to give it a try. > > ### Eclipse Workspace Patch 1.0 > #P camel-cxf > Index: > src/main/java/org/apache/camel/component/cxf/transport/CamelDestination.java > =================================================================== > --- > src/main/java/org/apache/camel/component/cxf/transport/CamelDestination.java > > (revision 831871) > +++ > src/main/java/org/apache/camel/component/cxf/transport/CamelDestination.java > > (working copy) > @@ -271,6 +271,12 @@ > > propagateResponseHeadersToCamel(outMessage, camelExchange); > > + // check if the outMessage has an exception > + Exception exception = outMessage.getContent(Exception.class); > + if (exception != null) { > + camelExchange.setException(exception); > + } > + > CachedOutputStream outputStream = > (CachedOutputStream)outMessage.getContent(OutputStream.class); > camelExchange.getOut().setBody(outputStream.getBytes()); > getLogger().log(Level.FINE, "send the response message: " > + outputStream); > > > > Schneider Christian wrote: >> Hi Claus, >> >> I have replaced the cxf server with the folowing route: >> <route> >> <from >> > uri="jms://queue.net.enbw.services.etg.examples.customerservice.CustomerServ >> ice" /> >> <transacted/> >> <to uri="serviceImplProc"/> >> </route> >> >> 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. >> >> Thanks already for your help >> >> 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@... >> >> Sitz der Gesellschaft: Karlsruhe >> Handelsregister: Amtsgericht Mannheim HRB 108550 >> Vorsitzender des Aufsichtsrats: Dr. Bernhard Beck >> Geschäftsführer: Jochen Adenau, Dr. Peter Krampf >> >> -----Ursprüngliche Nachricht----- >> Von: Claus Ibsen [mailto:claus.ibsen@...] >> Gesendet: Montag, 2. November 2009 14:56 >> An: users@... >> Betreff: Re: AW: Problem with SOAP/JMS and transactions >> >> On Mon, Nov 2, 2009 at 2:47 PM, Schneider Christian >> <Christian.Schneider@...> 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@... >>> >>> Sitz der Gesellschaft: Karlsruhe >>> Handelsregister: Amtsgericht Mannheim HRB 108550 >>> Vorsitzender des Aufsichtsrats: Dr. Bernhard Beck >>> Geschäftsführer: Jochen Adenau, Dr. Peter Krampf >>> >>> -----Ursprüngliche Nachricht----- >>> Von: Willem Jiang [mailto:willem.jiang@...] >>> Gesendet: Montag, 2. November 2009 14:27 >>> An: users@... >>> 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 >>>> <transacted/> to the route for the server. >>>> >>>> >>>> >>>> <beans xmlns="http://www.springframework.org/schema/beans" >>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >>>> xmlns:context="http://www.springframework.org/schema/context" >>>> xsi:schemaLocation="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" >>>> <context:annotation-config/> >>>> >>>> <import resource="classpath:META-INF/cxf/cxf.xml" /> >>>> <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" > /> >>>> <import resource="classpath:META-INF/cxf/cxf-extension-camel.xml" >> /> >>>> <import resource="classpath:serviceRuntimeContext.xml" /> >>>> >>>> <bean id="configProps" >>>> >>>> > class="org.springframework.beans.factory.config.PropertyPlaceholderConfigure >>>> r"> >>>> <property name="locations"> >>>> <list> >>>> <value>classpath:jms.properties</value> >>>> </list> >>>> </property> >>>> </bean> >>>> >>>> <!-- Make sure to read the best practices for design and >>>> implementation before >>>> developing a service for production use. >>>> http://wissen.enbw.net/display/etgsoa/3+-+Design >>>> http://wissen.enbw.net/display/etgsoa/4+-+Entwicklung >>>> --> >>>> <bean id="appModule" class="net.enbw.endur.AppModule"> >>>> <property name="customerService" ref="customerService"/> >>>> </bean> >>>> >>>> <bean id="serviceImpl" class="net.enbw.endur.ServiceImpl"> >>>> </bean> >>>> >>>> <!-- SOA configs below --> >>>> >>>> <endpoint id="customerServiceEndpoint" >>>> xmlns="http://cxf.apache.org/jaxws" >>>> xmlns:service="http://examples.etg.services.enbw.net/" >>>> serviceName="service:CustomerService" >>>> endpointName="service:CustomerServiceEndpoint" >>>> address="camel://direct:server" >>>> implementor="#serviceImpl"> >>>> <features> >>>> <!-- Enables logging of SOAP messages. --> >>>> <logging xmlns="http://cxf.apache.org/core" /> >>>> </features> >>>> </endpoint> >>>> >>>> <client id="customerService" xmlns="http://cxf.apache.org/jaxws" >>>> xmlns:service="http://examples.etg.services.enbw.net/" >>>> serviceName="service:CustomerService" >>>> endpointName="service:CustomerServiceEndpoint" >>>> >>>> > serviceClass="net.enbw.services.etg.examples.customerservice.CustomerService >>>> V1" >>>> address="camel://direct:client"> >>>> <features> >>>> <!-- Enables logging of SOAP messages. --> >>>> <!-- logging xmlns="http://cxf.apache.org/core" >> /--> >>>> </features> >>>> </client> >>>> >>>> <camelContext id="camelContext" trace="false" >>>> xmlns="http://camel.apache.org/schema/spring"> >>>> <route> >>>> <from uri="direct:client"/> >>>> <to >>>> > uri="jms://queue.net.enbw.services.etg.examples.customerservice.CustomerServ >>>> ice" /> >>>> </route> >>>> <route> >>>> <from >>>> > uri="jms://queue.net.enbw.services.etg.examples.customerservice.CustomerServ >>>> ice" /> >>>> <transacted/> >>>> <to uri="direct:server" /> >>>> </route> >>>> </camelContext> >>>> >>>> <!-- See http://camel.apache.org/jms.html --> >>>> <bean id="jms" >>>> class="org.apache.camel.component.jms.JmsComponent"> >>>> <constructor-arg index="0"> >>>> <ref bean="jmsConfiguration" /> >>>> </constructor-arg> >>>> <property name="connectionFactory" >>>> ref="jmsConnectionFactory" /> >>>> </bean> >>>> <bean id="jmsConfiguration" >>>> class="org.apache.camel.component.jms.JmsConfiguration"> >>>> <property name="useMessageIDAsCorrelationID" value="true" >> /> >>>> <property name="acknowledgementModeName" > value="TRANSACTED" >>>> /> >>>> <property name="explicitQosEnabled" value="true" /> >>>> <property name="receiveTimeout" >>>> value="${jms.receiveTimeout}" /> >>>> <property name="requestTimeout" >>>> value="${jms.requestTimeout}" /> >>>> <property name="recoveryInterval" >>>> value="${jms.recoveryInterval}" /> >>>> <property name="timeToLive" value="${jms.timeToLive}" /> >>>> <property name="transacted" value="true" /> >>>> <property name="transactedInOut" value="true" /> >>>> <property name="transactionManager" >>>> ref="jmsTransactionManager"/> >>>> </bean> >>>> >>>> <bean id="jmsTransactionManager" >>>> class="org.springframework.jms.connection.JmsTransactionManager"> >>>> <property name="connectionFactory" >>>> ref="jmsConnectionFactory" /> >>>> </bean> >>>> >>>> <!-- See Tibco EMS documentation --> >>>> <bean id="jmsConnectionFactory" >>>> class="com.tibco.tibjms.TibjmsConnectionFactory"> >>>> <property name="serverUrl" value="${jms.serverUrl}" /> >>>> <property name="userName" value="${jms.userName}" /> >>>> <property name="userPassword" value="${jms.userPassword}" >> /> >>>> <property name="reconnAttemptCount" >>>> value="${jms.reconnAttemptCount}" /> >>>> <property name="reconnAttemptDelay" >>>> value="${jms.reconnAttemptDelay}" /> >>>> </bean> >>>> >>>> </beans> >>>> >> >> > > |
|
|
AW: AW: AW: AW: Problem with SOAP/JMS and transactionsHi 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. 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´th 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. <route> <from uri="jms://queue.net.enbw.services.etg.examples.customerservice.CustomerServ ice" /> <onException> <exception>java.lang.Exception</exception> <handled> <constant>true</constant> </handled> <to uri="jms:queue.deadLetter" /> </onException> <transacted /> <to uri="direct:server" /> </route> 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 Business Solutions Handel und Dispatching Durlacher Allee 93 76131 Karlsruhe Tel : +49-(0)721-63-15482 Mail: christian.schneider@... Sitz der Gesellschaft: Karlsruhe Handelsregister: Amtsgericht Mannheim HRB 108550 Vorsitzender des Aufsichtsrats: Dr. Bernhard Beck Geschäftsführer: Jochen Adenau, Dr. Peter Krampf -----Ursprüngliche Nachricht----- Von: Willem Jiang [mailto:willem.jiang@...] Gesendet: Mittwoch, 4. November 2009 03:51 An: users@... 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 exception issue. Willem Schneider Christian wrote: > Hi Willem, > > 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. > > In the meantime I will try to use a onException() clause to do this > differentiation. > > I have also created a jira issue for the whole problem. > https://issues.apache.org/activemq/browse/CAMEL-2128 > > > 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@... > > Sitz der Gesellschaft: Karlsruhe > Handelsregister: Amtsgericht Mannheim HRB 108550 > Vorsitzender des Aufsichtsrats: Dr. Bernhard Beck > Geschäftsführer: Jochen Adenau, Dr. Peter Krampf > > -----Ursprüngliche Nachricht----- > Von: Willem Jiang [mailto:willem.jiang@...] > Gesendet: Montag, 2. November 2009 15:40 > An: users@... > 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 > in the Camel transport and let camel throw the exception. > > Here is my patch on the latest trunk code (not be verified yet), please > feel free to give it a try. > > ### Eclipse Workspace Patch 1.0 > #P camel-cxf > Index: > > =================================================================== > --- > src/main/java/org/apache/camel/component/cxf/transport/CamelDestination.java > > (revision 831871) > +++ > src/main/java/org/apache/camel/component/cxf/transport/CamelDestination.java > > (working copy) > @@ -271,6 +271,12 @@ > > propagateResponseHeadersToCamel(outMessage, camelExchange); > > + // check if the outMessage has an exception > + Exception exception = outMessage.getContent(Exception.class); > + if (exception != null) { > + camelExchange.setException(exception); > + } > + > CachedOutputStream outputStream = > (CachedOutputStream)outMessage.getContent(OutputStream.class); > camelExchange.getOut().setBody(outputStream.getBytes()); > getLogger().log(Level.FINE, "send the response message: " > + outputStream); > > > > Schneider Christian wrote: >> Hi Claus, >> >> I have replaced the cxf server with the folowing route: >> <route> >> <from >> > >> ice" /> >> <transacted/> >> <to uri="serviceImplProc"/> >> </route> >> >> 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 >> 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. >> >> Thanks already for your help >> >> 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@... >> >> Sitz der Gesellschaft: Karlsruhe >> Handelsregister: Amtsgericht Mannheim HRB 108550 >> Vorsitzender des Aufsichtsrats: Dr. Bernhard Beck >> Geschäftsführer: Jochen Adenau, Dr. Peter Krampf >> >> -----Ursprüngliche Nachricht----- >> Von: Claus Ibsen [mailto:claus.ibsen@...] >> Gesendet: Montag, 2. November 2009 14:56 >> An: users@... >> Betreff: Re: AW: Problem with SOAP/JMS and transactions >> >> On Mon, Nov 2, 2009 at 2:47 PM, Schneider Christian >> <Christian.Schneider@...> 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@... >>> >>> Sitz der Gesellschaft: Karlsruhe >>> Handelsregister: Amtsgericht Mannheim HRB 108550 >>> Vorsitzender des Aufsichtsrats: Dr. Bernhard Beck >>> Geschäftsführer: Jochen Adenau, Dr. Peter Krampf >>> >>> -----Ursprüngliche Nachricht----- >>> Von: Willem Jiang [mailto:willem.jiang@...] >>> Gesendet: Montag, 2. November 2009 14:27 >>> An: users@... >>> 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 >>>> <transacted/> to the route for the server. >>>> >>>> >>>> >>>> <beans xmlns="http://www.springframework.org/schema/beans" >>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >>>> xmlns:context="http://www.springframework.org/schema/context" >>>> xsi:schemaLocation="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" >>>> <context:annotation-config/> >>>> >>>> <import resource="classpath:META-INF/cxf/cxf.xml" /> >>>> <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" > /> >>>> <import resource="classpath:META-INF/cxf/cxf-extension-camel.xml" >> /> >>>> <import resource="classpath:serviceRuntimeContext.xml" /> >>>> >>>> <bean id="configProps" >>>> >>>> > >>>> r"> >>>> <property name="locations"> >>>> <list> >>>> <value>classpath:jms.properties</value> >>>> </list> >>>> </property> >>>> </bean> >>>> >>>> <!-- Make sure to read the best practices for design and >>>> implementation before >>>> developing a service for production use. >>>> http://wissen.enbw.net/display/etgsoa/3+-+Design >>>> http://wissen.enbw.net/display/etgsoa/4+-+Entwicklung >>>> --> >>>> <bean id="appModule" class="net.enbw.endur.AppModule"> >>>> <property name="customerService" ref="customerService"/> >>>> </bean> >>>> >>>> <bean id="serviceImpl" class="net.enbw.endur.ServiceImpl"> >>>> </bean> >>>> >>>> <!-- SOA configs below --> >>>> >>>> <endpoint id="customerServiceEndpoint" >>>> xmlns="http://cxf.apache.org/jaxws" >>>> xmlns:service="http://examples.etg.services.enbw.net/" >>>> serviceName="service:CustomerService" >>>> endpointName="service:CustomerServiceEndpoint" >>>> address="camel://direct:server" >>>> implementor="#serviceImpl"> >>>> <features> >>>> <!-- Enables logging of SOAP messages. --> >>>> <logging xmlns="http://cxf.apache.org/core" /> >>>> </features> >>>> </endpoint> >>>> >>>> <client id="customerService" xmlns="http://cxf.apache.org/jaxws" >>>> xmlns:service="http://examples.etg.services.enbw.net/" >>>> serviceName="service:CustomerService" >>>> endpointName="service:CustomerServiceEndpoint" >>>> >>>> > >>>> V1" >>>> address="camel://direct:client"> >>>> <features> >>>> <!-- Enables logging of SOAP messages. --> >>>> <!-- logging xmlns="http://cxf.apache.org/core" >> /--> >>>> </features> >>>> </client> >>>> >>>> <camelContext id="camelContext" trace="false" >>>> xmlns="http://camel.apache.org/schema/spring"> >>>> <route> >>>> <from uri="direct:client"/> >>>> <to >>>> > >>>> ice" /> >>>> </route> >>>> <route> >>>> <from >>>> > uri="jms://queue.net.enbw.services.etg.examples.customerservice.CustomerServ >>>> ice" /> >>>> <transacted/> >>>> <to uri="direct:server" /> >>>> </route> >>>> </camelContext> >>>> >>>> <!-- See http://camel.apache.org/jms.html --> >>>> <bean id="jms" >>>> class="org.apache.camel.component.jms.JmsComponent"> >>>> <constructor-arg index="0"> >>>> <ref bean="jmsConfiguration" /> >>>> </constructor-arg> >>>> <property name="connectionFactory" >>>> ref="jmsConnectionFactory" /> >>>> </bean> >>>> <bean id="jmsConfiguration" >>>> class="org.apache.camel.component.jms.JmsConfiguration"> >>>> <property name="useMessageIDAsCorrelationID" value="true" >> /> >>>> <property name="acknowledgementModeName" > value="TRANSACTED" >>>> /> >>>> <property name="explicitQosEnabled" value="true" /> >>>> <property name="receiveTimeout" >>>> value="${jms.receiveTimeout}" /> >>>> <property name="requestTimeout" >>>> value="${jms.requestTimeout}" /> >>>> <property name="recoveryInterval" >>>> value="${jms.recoveryInterval}" /> >>>> <property name="timeToLive" value="${jms.timeToLive}" /> >>>> <property name="transacted" value="true" /> >>>> <property name="transactedInOut" value="true" /> >>>> <property name="transactionManager" >>>> ref="jmsTransactionManager"/> >>>> </bean> >>>> >>>> <bean id="jmsTransactionManager" >>>> class="org.springframework.jms.connection.JmsTransactionManager"> >>>> <property name="connectionFactory" >>>> ref="jmsConnectionFactory" /> >>>> </bean> >>>> >>>> <!-- See Tibco EMS documentation --> >>>> <bean id="jmsConnectionFactory" >>>> class="com.tibco.tibjms.TibjmsConnectionFactory"> >>>> <property name="serverUrl" value="${jms.serverUrl}" /> >>>> <property name="userName" value="${jms.userName}" /> >>>> <property name="userPassword" value="${jms.userPassword}" >> /> >>>> <property name="reconnAttemptCount" >>>> value="${jms.reconnAttemptCount}" /> >>>> <property name="reconnAttemptDelay" >>>> value="${jms.reconnAttemptDelay}" /> >>>> </bean> >>>> >>>> </beans> >>>> >> >> > > |
|
|
Re: AW: AW: AW: Problem with SOAP/JMS and transactionsOn Wed, Nov 4, 2009 at 2:56 PM, Schneider Christian
<Christian.Schneider@...> wrote: > 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. > > 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´th time to a dead letter queue. > The JMS Broker have a build in dead letter queue mechanism. > 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. > <route> > <from > uri="jms://queue.net.enbw.services.etg.examples.customerservice.CustomerServ > ice" /> > <onException> > <exception>java.lang.Exception</exception> > <handled> > <constant>true</constant> > </handled> > <to uri="jms:queue.deadLetter" /> > </onException> > <transacted /> > <to uri="direct:server" /> > </route> > > 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 > Business Solutions > Handel und Dispatching > Durlacher Allee 93 > 76131 Karlsruhe > > Tel : +49-(0)721-63-15482 > Mail: christian.schneider@... > > Sitz der Gesellschaft: Karlsruhe > Handelsregister: Amtsgericht Mannheim HRB 108550 > Vorsitzender des Aufsichtsrats: Dr. Bernhard Beck > Geschäftsführer: Jochen Adenau, Dr. Peter Krampf > > -----Ursprüngliche Nachricht----- > Von: Willem Jiang [mailto:willem.jiang@...] > Gesendet: Mittwoch, 4. November 2009 03:51 > An: users@... > 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 > exception issue. > > Willem > Schneider Christian wrote: >> Hi Willem, >> >> 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. >> >> In the meantime I will try to use a onException() clause to do this >> differentiation. >> >> I have also created a jira issue for the whole problem. >> https://issues.apache.org/activemq/browse/CAMEL-2128 >> >> >> 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@... >> >> Sitz der Gesellschaft: Karlsruhe >> Handelsregister: Amtsgericht Mannheim HRB 108550 >> Vorsitzender des Aufsichtsrats: Dr. Bernhard Beck >> Geschäftsführer: Jochen Adenau, Dr. Peter Krampf >> >> -----Ursprüngliche Nachricht----- >> Von: Willem Jiang [mailto:willem.jiang@...] >> Gesendet: Montag, 2. November 2009 15:40 >> An: users@... >> 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 >> in the Camel transport and let camel throw the exception. >> >> Here is my patch on the latest trunk code (not be verified yet), please >> feel free to give it a try. >> >> ### Eclipse Workspace Patch 1.0 >> #P camel-cxf >> Index: >> > src/main/java/org/apache/camel/component/cxf/transport/CamelDestination.java >> =================================================================== >> --- >> > src/main/java/org/apache/camel/component/cxf/transport/CamelDestination.java >> >> (revision 831871) >> +++ >> > src/main/java/org/apache/camel/component/cxf/transport/CamelDestination.java >> >> (working copy) >> @@ -271,6 +271,12 @@ >> >> propagateResponseHeadersToCamel(outMessage, camelExchange); >> >> + // check if the outMessage has an exception >> + Exception exception = outMessage.getContent(Exception.class); >> + if (exception != null) { >> + camelExchange.setException(exception); >> + } >> + >> CachedOutputStream outputStream = >> (CachedOutputStream)outMessage.getContent(OutputStream.class); >> camelExchange.getOut().setBody(outputStream.getBytes()); >> getLogger().log(Level.FINE, "send the response message: " >> + outputStream); >> >> >> >> Schneider Christian wrote: >>> Hi Claus, >>> >>> I have replaced the cxf server with the folowing route: >>> <route> >>> <from >>> >> > uri="jms://queue.net.enbw.services.etg.examples.customerservice.CustomerServ >>> ice" /> >>> <transacted/> >>> <to uri="serviceImplProc"/> >>> </route> >>> >>> 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. >>> >>> Thanks already for your help >>> >>> 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@... >>> >>> Sitz der Gesellschaft: Karlsruhe >>> Handelsregister: Amtsgericht Mannheim HRB 108550 >>> Vorsitzender des Aufsichtsrats: Dr. Bernhard Beck >>> Geschäftsführer: Jochen Adenau, Dr. Peter Krampf >>> >>> -----Ursprüngliche Nachricht----- >>> Von: Claus Ibsen [mailto:claus.ibsen@...] >>> Gesendet: Montag, 2. November 2009 14:56 >>> An: users@... >>> Betreff: Re: AW: Problem with SOAP/JMS and transactions >>> >>> On Mon, Nov 2, 2009 at 2:47 PM, Schneider Christian >>> <Christian.Schneider@...> 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@... >>>> >>>> Sitz der Gesellschaft: Karlsruhe >>>> Handelsregister: Amtsgericht Mannheim HRB 108550 >>>> Vorsitzender des Aufsichtsrats: Dr. Bernhard Beck >>>> Geschäftsführer: Jochen Adenau, Dr. Peter Krampf >>>> >>>> -----Ursprüngliche Nachricht----- >>>> Von: Willem Jiang [mailto:willem.jiang@...] >>>> Gesendet: Montag, 2. November 2009 14:27 >>>> An: users@... >>>> 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 >>>>> <transacted/> to the route for the server. >>>>> >>>>> >>>>> >>>>> <beans xmlns="http://www.springframework.org/schema/beans" >>>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >>>>> xmlns:context="http://www.springframework.org/schema/context" >>>>> xsi:schemaLocation="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" >>>>> <context:annotation-config/> >>>>> >>>>> <import resource="classpath:META-INF/cxf/cxf.xml" /> >>>>> <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" >> /> >>>>> <import resource="classpath:META-INF/cxf/cxf-extension-camel.xml" >>> /> >>>>> <import resource="classpath:serviceRuntimeContext.xml" /> >>>>> >>>>> <bean id="configProps" >>>>> >>>>> >> > class="org.springframework.beans.factory.config.PropertyPlaceholderConfigure >>>>> r"> >>>>> <property name="locations"> >>>>> <list> >>>>> <value>classpath:jms.properties</value> >>>>> </list> >>>>> </property> >>>>> </bean> >>>>> >>>>> <!-- Make sure to read the best practices for design and >>>>> implementation before >>>>> developing a service for production use. >>>>> http://wissen.enbw.net/display/etgsoa/3+-+Design >>>>> http://wissen.enbw.net/display/etgsoa/4+-+Entwicklung >>>>> --> >>>>> <bean id="appModule" class="net.enbw.endur.AppModule"> >>>>> <property name="customerService" ref="customerService"/> >>>>> </bean> >>>>> >>>>> <bean id="serviceImpl" class="net.enbw.endur.ServiceImpl"> >>>>> </bean> >>>>> >>>>> <!-- SOA configs below --> >>>>> >>>>> <endpoint id="customerServiceEndpoint" >>>>> xmlns="http://cxf.apache.org/jaxws" >>>>> xmlns:service="http://examples.etg.services.enbw.net/" >>>>> serviceName="service:CustomerService" >>>>> endpointName="service:CustomerServiceEndpoint" >>>>> address="camel://direct:server" >>>>> implementor="#serviceImpl"> >>>>> <features> >>>>> <!-- Enables logging of SOAP messages. --> >>>>> <logging xmlns="http://cxf.apache.org/core" /> >>>>> </features> >>>>> </endpoint> >>>>> >>>>> <client id="customerService" xmlns="http://cxf.apache.org/jaxws" >>>>> xmlns:service="http://examples.etg.services.enbw.net/" >>>>> serviceName="service:CustomerService" >>>>> endpointName="service:CustomerServiceEndpoint" >>>>> >>>>> >> > serviceClass="net.enbw.services.etg.examples.customerservice.CustomerService >>>>> V1" >>>>> address="camel://direct:client"> >>>>> <features> >>>>> <!-- Enables logging of SOAP messages. --> >>>>> <!-- logging xmlns="http://cxf.apache.org/core" >>> /--> >>>>> </features> >>>>> </client> >>>>> >>>>> <camelContext id="camelContext" trace="false" >>>>> xmlns="http://camel.apache.org/schema/spring"> >>>>> <route> >>>>> <from uri="direct:client"/> >>>>> <to >>>>> >> > uri="jms://queue.net.enbw.services.etg.examples.customerservice.CustomerServ >>>>> ice" /> >>>>> </route> >>>>> <route> >>>>> <from >>>>> >> > uri="jms://queue.net.enbw.services.etg.examples.customerservice.CustomerServ >>>>> ice" /> >>>>> <transacted/> >>>>> <to uri="direct:server" /> >>>>> </route> >>>>> </camelContext> >>>>> >>>>> <!-- See http://camel.apache.org/jms.html --> >>>>> <bean id="jms" >>>>> class="org.apache.camel.component.jms.JmsComponent"> >>>>> <constructor-arg index="0"> >>>>> <ref bean="jmsConfiguration" /> >>>>> </constructor-arg> >>>>> <property name="connectionFactory" >>>>> ref="jmsConnectionFactory" /> >>>>> </bean> >>>>> <bean id="jmsConfiguration" >>>>> class="org.apache.camel.component.jms.JmsConfiguration"> >>>>> <property name="useMessageIDAsCorrelationID" value="true" >>> /> >>>>> <property name="acknowledgementModeName" >> value="TRANSACTED" >>>>> /> >>>>> <property name="explicitQosEnabled" value="true" /> >>>>> <property name="receiveTimeout" >>>>> value="${jms.receiveTimeout}" /> >>>>> <property name="requestTimeout" >>>>> value="${jms.requestTimeout}" /> >>>>> <property name="recoveryInterval" >>>>> value="${jms.recoveryInterval}" /> >>>>> <property name="timeToLive" value="${jms.timeToLive}" /> >>>>> <property name="transacted" value="true" /> >>>>> <property name="transactedInOut" value="true" /> >>>>> <property name="transactionManager" >>>>> ref="jmsTransactionManager"/> >>>>> </bean> >>>>> >>>>> <bean id="jmsTransactionManager" >>>>> class="org.springframework.jms.connection.JmsTransactionManager"> >>>>> <property name="connectionFactory" >>>>> ref="jmsConnectionFactory" /> >>>>> </bean> >>>>> >>>>> <!-- See Tibco EMS documentation --> >>>>> <bean id="jmsConnectionFactory" >>>>> class="com.tibco.tibjms.TibjmsConnectionFactory"> >>>>> <property name="serverUrl" value="${jms.serverUrl}" /> >>>>> <property name="userName" value="${jms.userName}" /> >>>>> <property name="userPassword" value="${jms.userPassword}" >>> /> >>>>> <property name="reconnAttemptCount" >>>>> value="${jms.reconnAttemptCount}" /> >>>>> <property name="reconnAttemptDelay" >>>>> value="${jms.reconnAttemptDelay}" /> >>>>> </bean> >>>>> >>>>> </beans> >>>>> >>> >>> >> >> > > -- Claus Ibsen Apache Camel Committer Author of Camel in Action: http://www.manning.com/ibsen/ Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus |
|
|
AW: AW: AW: AW: Problem with SOAP/JMS and transactionsHi Claus,
of course brokers like ActiveMQ have a great dead letter facility. Unfortunately we are stuck with Tibco EMS here. As it seems EMS by default will discard messages after the maximum number of redeliveries. You can set a property JMS_TIBCO_PRESERVE_UNDELIVERED=true to make Tibco delivery the message to the dead letter queue after the retries. The problem is that this property has to be set on each message by the client. Can I set this property with Camel? I searched a little in the documentation and the code and it seems that properties that start with JMS but are no official headers are ignored. So as this is a little difficult to do in Tibco EMS I was thinking about using the dead letter or onException facitlity in camel instead. 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@... Sitz der Gesellschaft: Karlsruhe Handelsregister: Amtsgericht Mannheim HRB 108550 Vorsitzender des Aufsichtsrats: Dr. Bernhard Beck Geschäftsführer: Jochen Adenau, Dr. Peter Krampf -----Ursprüngliche Nachricht----- Von: Claus Ibsen [mailto:claus.ibsen@...] Gesendet: Mittwoch, 4. November 2009 15:04 An: users@... Betreff: Re: AW: AW: AW: Problem with SOAP/JMS and transactions On Wed, Nov 4, 2009 at 2:56 PM, Schneider Christian <Christian.Schneider@...> wrote: > 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. > > 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´th time to a dead letter queue. > The JMS Broker have a build in dead letter queue mechanism. -- Claus Ibsen Apache Camel Committer Author of Camel in Action: http://www.manning.com/ibsen/ Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus |
|
|
Re: AW: AW: AW: Problem with SOAP/JMS and transactionsOn Wed, Nov 4, 2009 at 4:28 PM, Schneider Christian
<Christian.Schneider@...> wrote: > Hi Claus, > > of course brokers like ActiveMQ have a great dead letter facility. > Unfortunately we are stuck with Tibco EMS here. > As it seems EMS by default will discard messages after the maximum number of > redeliveries. > You can set a property JMS_TIBCO_PRESERVE_UNDELIVERED=true to make Tibco > delivery the message to the dead letter queue after the retries. The problem > is that this property has to be set on each message by the client. > We fixed an issue on trunk with JMS_<vendor> headers. But if you have to set them on the client then you are kind lost as I assume Camel is the one that consumes from the JMS queue. And I doubt you can set the header *afterwards*. I would ask the TIBCO people if there isnt a better way. Some FUSE customers do also have Tibco and I havent header of this issue before. > Can I set this property with Camel? I searched a little in the documentation > and the code and it seems that properties that start with JMS but are no > official headers are ignored. > > So as this is a little difficult to do in Tibco EMS I was thinking about > using the dead letter or onException facitlity in camel instead. > Yeah you can do that as a plan b. > 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@... > > Sitz der Gesellschaft: Karlsruhe > Handelsregister: Amtsgericht Mannheim HRB 108550 > Vorsitzender des Aufsichtsrats: Dr. Bernhard Beck > Geschäftsführer: Jochen Adenau, Dr. Peter Krampf > > -----Ursprüngliche Nachricht----- > Von: Claus Ibsen [mailto:claus.ibsen@...] > Gesendet: Mittwoch, 4. November 2009 15:04 > An: users@... > Betreff: Re: AW: AW: AW: Problem with SOAP/JMS and transactions > > On Wed, Nov 4, 2009 at 2:56 PM, Schneider Christian > <Christian.Schneider@...> wrote: >> 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. >> >> 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´th time to a dead letter queue. >> > > The JMS Broker have a build in dead letter queue mechanism. > > > > -- > Claus Ibsen > Apache Camel Committer > > Author of Camel in Action: http://www.manning.com/ibsen/ > Open Source Integration: http://fusesource.com > Blog: http://davsclaus.blogspot.com/ > Twitter: http://twitter.com/davsclaus > -- Claus Ibsen Apache Camel Committer Author of Camel in Action: http://www.manning.com/ibsen/ Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus |
|
|
Re: AW: AW: AW: AW: Problem with SOAP/JMS and transactionsHi Christian,
If I remember right, camel-jms component have trouble to get the message from queue and send the message to another queue if you enable the transaction. So, maybe the option 1 is a way you should look for. Willem Schneider Christian wrote: > 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. > > 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´th 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. > <route> > <from > uri="jms://queue.net.enbw.services.etg.examples.customerservice.CustomerServ > ice" /> > <onException> > <exception>java.lang.Exception</exception> > <handled> > <constant>true</constant> > </handled> > <to uri="jms:queue.deadLetter" /> > </onException> > <transacted /> > <to uri="direct:server" /> > </route> > > 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 > Business Solutions > Handel und Dispatching > Durlacher Allee 93 > 76131 Karlsruhe > > Tel : +49-(0)721-63-15482 > Mail: christian.schneider@... > > Sitz der Gesellschaft: Karlsruhe > Handelsregister: Amtsgericht Mannheim HRB 108550 > Vorsitzender des Aufsichtsrats: Dr. Bernhard Beck > Geschäftsführer: Jochen Adenau, Dr. Peter Krampf > > -----Ursprüngliche Nachricht----- > Von: Willem Jiang [mailto:willem.jiang@...] > Gesendet: Mittwoch, 4. November 2009 03:51 > An: users@... > 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 > exception issue. > > Willem > Schneider Christian wrote: >> Hi Willem, >> >> 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. >> >> In the meantime I will try to use a onException() clause to do this >> differentiation. >> >> I have also created a jira issue for the whole problem. >> https://issues.apache.org/activemq/browse/CAMEL-2128 >> >> >> 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@... >> >> Sitz der Gesellschaft: Karlsruhe >> Handelsregister: Amtsgericht Mannheim HRB 108550 >> Vorsitzender des Aufsichtsrats: Dr. Bernhard Beck >> Geschäftsführer: Jochen Adenau, Dr. Peter Krampf >> >> -----Ursprüngliche Nachricht----- >> Von: Willem Jiang [mailto:willem.jiang@...] >> Gesendet: Montag, 2. November 2009 15:40 >> An: users@... >> 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 >> in the Camel transport and let camel throw the exception. >> >> Here is my patch on the latest trunk code (not be verified yet), please >> feel free to give it a try. >> >> ### Eclipse Workspace Patch 1.0 >> #P camel-cxf >> Index: >> > src/main/java/org/apache/camel/component/cxf/transport/CamelDestination.java >> =================================================================== >> --- >> > src/main/java/org/apache/camel/component/cxf/transport/CamelDestination.java >> (revision 831871) >> +++ >> > src/main/java/org/apache/camel/component/cxf/transport/CamelDestination.java >> (working copy) >> @@ -271,6 +271,12 @@ >> >> propagateResponseHeadersToCamel(outMessage, camelExchange); >> >> + // check if the outMessage has an exception >> + Exception exception = outMessage.getContent(Exception.class); >> + if (exception != null) { >> + camelExchange.setException(exception); >> + } >> + >> CachedOutputStream outputStream = >> (CachedOutputStream)outMessage.getContent(OutputStream.class); >> camelExchange.getOut().setBody(outputStream.getBytes()); >> getLogger().log(Level.FINE, "send the response message: " >> + outputStream); >> >> >> >> Schneider Christian wrote: >>> Hi Claus, >>> >>> I have replaced the cxf server with the folowing route: >>> <route> >>> <from >>> > uri="jms://queue.net.enbw.services.etg.examples.customerservice.CustomerServ >>> ice" /> >>> <transacted/> >>> <to uri="serviceImplProc"/> >>> </route> >>> >>> 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. >>> >>> Thanks already for your help >>> >>> 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@... >>> >>> Sitz der Gesellschaft: Karlsruhe >>> Handelsregister: Amtsgericht Mannheim HRB 108550 >>> Vorsitzender des Aufsichtsrats: Dr. Bernhard Beck >>> Geschäftsführer: Jochen Adenau, Dr. Peter Krampf >>> >>> -----Ursprüngliche Nachricht----- >>> Von: Claus Ibsen [mailto:claus.ibsen@...] >>> Gesendet: Montag, 2. November 2009 14:56 >>> An: users@... >>> Betreff: Re: AW: Problem with SOAP/JMS and transactions >>> >>> On Mon, Nov 2, 2009 at 2:47 PM, Schneider Christian >>> <Christian.Schneider@...> 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@... >>>> >>>> Sitz der Gesellschaft: Karlsruhe >>>> Handelsregister: Amtsgericht Mannheim HRB 108550 >>>> Vorsitzender des Aufsichtsrats: Dr. Bernhard Beck >>>> Geschäftsführer: Jochen Adenau, Dr. Peter Krampf >>>> >>>> -----Ursprüngliche Nachricht----- >>>> Von: Willem Jiang [mailto:willem.jiang@...] >>>> Gesendet: Montag, 2. November 2009 14:27 >>>> An: users@... >>>> 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 >>>>> <transacted/> to the route for the server. >>>>> >>>>> >>>>> >>>>> <beans xmlns="http://www.springframework.org/schema/beans" >>>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >>>>> xmlns:context="http://www.springframework.org/schema/context" >>>>> xsi:schemaLocation="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" >>>>> <context:annotation-config/> >>>>> >>>>> <import resource="classpath:META-INF/cxf/cxf.xml" /> >>>>> <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" >> /> >>>>> <import resource="classpath:META-INF/cxf/cxf-extension-camel.xml" >>> /> >>>>> <import resource="classpath:serviceRuntimeContext.xml" /> >>>>> >>>>> <bean id="configProps" >>>>> >>>>> > class="org.springframework.beans.factory.config.PropertyPlaceholderConfigure >>>>> r"> >>>>> <property name="locations"> >>>>> <list> >>>>> <value>classpath:jms.properties</value> >>>>> </list> >>>>> </property> >>>>> </bean> >>>>> >>>>> <!-- Make sure to read the best practices for design and >>>>> implementation before >>>>> developing a service for production use. >>>>> http://wissen.enbw.net/display/etgsoa/3+-+Design >>>>> http://wissen.enbw.net/display/etgsoa/4+-+Entwicklung >>>>> --> >>>>> <bean id="appModule" class="net.enbw.endur.AppModule"> >>>>> <property name="customerService" ref="customerService"/> >>>>> </bean> >>>>> >>>>> <bean id="serviceImpl" class="net.enbw.endur.ServiceImpl"> >>>>> </bean> >>>>> >>>>> <!-- SOA configs below --> >>>>> >>>>> <endpoint id="customerServiceEndpoint" >>>>> xmlns="http://cxf.apache.org/jaxws" >>>>> xmlns:service="http://examples.etg.services.enbw.net/" >>>>> serviceName="service:CustomerService" >>>>> endpointName="service:CustomerServiceEndpoint" >>>>> address="camel://direct:server" >>>>> implementor="#serviceImpl"> >>>>> <features> >>>>> <!-- Enables logging of SOAP messages. --> >>>>> <logging xmlns="http://cxf.apache.org/core" /> >>>>> </features> >>>>> </endpoint> >>>>> >>>>> <client id="customerService" xmlns="http://cxf.apache.org/jaxws" >>>>> xmlns:service="http://examples.etg.services.enbw.net/" >>>>> serviceName="service:CustomerService" >>>>> endpointName="service:CustomerServiceEndpoint" >>>>> >>>>> > serviceClass="net.enbw.services.etg.examples.customerservice.CustomerService >>>>> V1" >>>>> address="camel://direct:client"> >>>>> <features> >>>>> <!-- Enables logging of SOAP messages. --> >>>>> <!-- logging xmlns="http://cxf.apache.org/core" >>> /--> >>>>> </features> >>>>> </client> >>>>> >>>>> <camelContext id="camelContext" trace="false" >>>>> xmlns="http://camel.apache.org/schema/spring"> >>>>> <route> >>>>> <from uri="direct:client"/> >>>>> <to >>>>> > uri="jms://queue.net.enbw.services.etg.examples.customerservice.CustomerServ >>>>> ice" /> >>>>> </route> >>>>> <route> >>>>> <from >>>>> > uri="jms://queue.net.enbw.services.etg.examples.customerservice.CustomerServ >>>>> ice" /> >>>>> <transacted/> >>>>> <to uri="direct:server" /> >>>>> </route> >>>>> </camelContext> >>>>> >>>>> <!-- See http://camel.apache.org/jms.html --> >>>>> <bean id="jms" >>>>> class="org.apache.camel.component.jms.JmsComponent"> >>>>> <constructor-arg index="0"> >>>>> <ref bean="jmsConfiguration" /> >>>>> </constructor-arg> >>>>> <property name="connectionFactory" >>>>> ref="jmsConnectionFactory" /> >>>>> </bean> >>>>> <bean id="jmsConfiguration" >>>>> class="org.apache.camel.component.jms.JmsConfiguration"> >>>>> <property name="useMessageIDAsCorrelationID" value="true" >>> /> >>>>> <property name="acknowledgementModeName" >> value="TRANSACTED" >>>>> /> >>>>> <property name="explicitQosEnabled" value="true" /> >>>>> <property name="receiveTimeout" >>>>> value="${jms.receiveTimeout}" /> >>>>> <property name="requestTimeout" >>>>> value="${jms.requestTimeout}" /> >>>>> <property name="recoveryInterval" >>>>> value="${jms.recoveryInterval}" /> >>>>> <property name="timeToLive" value="${jms.timeToLive}" /> >>>>> <property name="transacted" value="true" /> >>>>> <property name="transactedInOut" value="true" /> >>>>> <property name="transactionManager" >>>>> ref="jmsTransactionManager"/> >>>>> </bean> >>>>> >>>>> <bean id="jmsTransactionManager" >>>>> class="org.springframework.jms.connection.JmsTransactionManager"> >>>>> <property name="connectionFactory" >>>>> ref="jmsConnectionFactory" /> >>>>> </bean> >>>>> >>>>> <!-- See Tibco EMS documentation --> >>>>> <bean id="jmsConnectionFactory" >>>>> class="com.tibco.tibjms.TibjmsConnectionFactory"> >>>>> <property name="serverUrl" value="${jms.serverUrl}" /> >>>>> <property name="userName" value="${jms.userName}" /> >>>>> <property name="userPassword" value="${jms.userPassword}" >>> /> >>>>> <property name="reconnAttemptCount" >>>>> value="${jms.reconnAttemptCount}" /> >>>>> <property name="reconnAttemptDelay" >>>>> value="${jms.reconnAttemptDelay}" /> >>>>> </bean> >>>>> >>>>> </beans> >>>>> >>> >> > > |
|
|
Re: AW: AW: AW: AW: Problem with SOAP/JMS and transactionsOn Thu, Nov 5, 2009 at 8:27 AM, Willem Jiang <willem.jiang@...> wrote:
> Hi Christian, > > If I remember right, camel-jms component have trouble to get the message > from queue and send the message to another queue if you enable the > transaction. > No that is possible. Its request/reply over a queue that is not possible. from A -> to B -> to C where B wants to do a request/reply over another JMS queue. However you can do from A -> process failed -> to Error Queue To let Camel act and handle the errors. > So, maybe the option 1 is a way you should look for. > > Willem > > Schneider Christian wrote: >> >> 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. >> 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´th 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. >> <route> >> <from >> >> uri="jms://queue.net.enbw.services.etg.examples.customerservice.CustomerServ >> ice" /> >> <onException> >> <exception>java.lang.Exception</exception> >> <handled> >> <constant>true</constant> >> </handled> >> <to uri="jms:queue.deadLetter" /> >> </onException> >> <transacted /> >> <to uri="direct:server" /> >> </route> >> >> 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 Business Solutions >> Handel und Dispatching >> Durlacher Allee 93 >> 76131 Karlsruhe >> >> Tel : +49-(0)721-63-15482 >> Mail: christian.schneider@... >> >> Sitz der Gesellschaft: Karlsruhe >> Handelsregister: Amtsgericht Mannheim HRB 108550 >> Vorsitzender des Aufsichtsrats: Dr. Bernhard Beck >> Geschäftsführer: Jochen Adenau, Dr. Peter Krampf >> >> -----Ursprüngliche Nachricht----- >> Von: Willem Jiang [mailto:willem.jiang@...] Gesendet: Mittwoch, 4. >> November 2009 03:51 >> An: users@... >> 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 exception >> issue. >> >> Willem >> Schneider Christian wrote: >>> >>> Hi Willem, >>> >>> 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. >>> >>> In the meantime I will try to use a onException() clause to do this >>> differentiation. >>> >>> I have also created a jira issue for the whole problem. >>> https://issues.apache.org/activemq/browse/CAMEL-2128 >>> >>> >>> 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@... >>> >>> Sitz der Gesellschaft: Karlsruhe >>> Handelsregister: Amtsgericht Mannheim HRB 108550 >>> Vorsitzender des Aufsichtsrats: Dr. Bernhard Beck >>> Geschäftsführer: Jochen Adenau, Dr. Peter Krampf >>> >>> -----Ursprüngliche Nachricht----- >>> Von: Willem Jiang [mailto:willem.jiang@...] Gesendet: Montag, 2. >>> November 2009 15:40 >>> An: users@... >>> 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 >>> in the Camel transport and let camel throw the exception. >>> >>> Here is my patch on the latest trunk code (not be verified yet), please >>> feel free to give it a try. >>> >>> ### Eclipse Workspace Patch 1.0 >>> #P camel-cxf >>> Index: >> >> >> src/main/java/org/apache/camel/component/cxf/transport/CamelDestination.java >>> >>> =================================================================== >>> --- >> >> >> src/main/java/org/apache/camel/component/cxf/transport/CamelDestination.java >>> >>> (revision 831871) >>> +++ >> >> >> src/main/java/org/apache/camel/component/cxf/transport/CamelDestination.java >>> >>> (working copy) >>> @@ -271,6 +271,12 @@ >>> >>> propagateResponseHeadersToCamel(outMessage, camelExchange); >>> >>> + // check if the outMessage has an exception >>> + Exception exception = >>> outMessage.getContent(Exception.class); >>> + if (exception != null) { >>> + camelExchange.setException(exception); >>> + } >>> + >>> CachedOutputStream outputStream = >>> (CachedOutputStream)outMessage.getContent(OutputStream.class); >>> camelExchange.getOut().setBody(outputStream.getBytes()); >>> getLogger().log(Level.FINE, "send the response message: " + >>> outputStream); >>> >>> >>> >>> Schneider Christian wrote: >>>> >>>> Hi Claus, >>>> >>>> I have replaced the cxf server with the folowing route: >>>> <route> >>>> <from >>>> >> >> uri="jms://queue.net.enbw.services.etg.examples.customerservice.CustomerServ >>>> >>>> ice" /> >>>> <transacted/> >>>> <to uri="serviceImplProc"/> >>>> </route> >>>> 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. >>>> Thanks already for your help >>>> >>>> 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@... >>>> >>>> Sitz der Gesellschaft: Karlsruhe >>>> Handelsregister: Amtsgericht Mannheim HRB 108550 >>>> Vorsitzender des Aufsichtsrats: Dr. Bernhard Beck >>>> Geschäftsführer: Jochen Adenau, Dr. Peter Krampf >>>> >>>> -----Ursprüngliche Nachricht----- >>>> Von: Claus Ibsen [mailto:claus.ibsen@...] Gesendet: Montag, 2. >>>> November 2009 14:56 >>>> An: users@... >>>> Betreff: Re: AW: Problem with SOAP/JMS and transactions >>>> >>>> On Mon, Nov 2, 2009 at 2:47 PM, Schneider Christian >>>> <Christian.Schneider@...> 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@... >>>>> >>>>> Sitz der Gesellschaft: Karlsruhe >>>>> Handelsregister: Amtsgericht Mannheim HRB 108550 >>>>> Vorsitzender des Aufsichtsrats: Dr. Bernhard Beck >>>>> Geschäftsführer: Jochen Adenau, Dr. Peter Krampf >>>>> >>>>> -----Ursprüngliche Nachricht----- >>>>> Von: Willem Jiang [mailto:willem.jiang@...] >>>>> Gesendet: Montag, 2. November 2009 14:27 >>>>> An: users@... >>>>> 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 >>>>>> <transacted/> to the route for the server. >>>>>> >>>>>> >>>>>> >>>>>> <beans xmlns="http://www.springframework.org/schema/beans" >>>>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >>>>>> xmlns:context="http://www.springframework.org/schema/context" >>>>>> xsi:schemaLocation="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" >>>>>> <context:annotation-config/> >>>>>> >>>>>> <import resource="classpath:META-INF/cxf/cxf.xml" /> >>>>>> <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" >>> >>> /> >>>>>> >>>>>> <import resource="classpath:META-INF/cxf/cxf-extension-camel.xml" >>>> >>>> /> >>>>>> >>>>>> <import resource="classpath:serviceRuntimeContext.xml" /> >>>>>> >>>>>> <bean id="configProps" >>>>>> >>>>>> >> >> class="org.springframework.beans.factory.config.PropertyPlaceholderConfigure >>>>>> >>>>>> r"> >>>>>> <property name="locations"> >>>>>> <list> >>>>>> <value>classpath:jms.properties</value> >>>>>> </list> >>>>>> </property> >>>>>> </bean> >>>>>> >>>>>> <!-- Make sure to read the best practices for design and >>>>>> implementation before >>>>>> developing a service for production use. >>>>>> http://wissen.enbw.net/display/etgsoa/3+-+Design >>>>>> http://wissen.enbw.net/display/etgsoa/4+-+Entwicklung >>>>>> --> >>>>>> <bean id="appModule" class="net.enbw.endur.AppModule"> >>>>>> <property name="customerService" ref="customerService"/> >>>>>> </bean> >>>>>> >>>>>> <bean id="serviceImpl" class="net.enbw.endur.ServiceImpl"> >>>>>> </bean> >>>>>> >>>>>> <!-- SOA configs below --> >>>>>> >>>>>> <endpoint id="customerServiceEndpoint" >>>>>> xmlns="http://cxf.apache.org/jaxws" >>>>>> xmlns:service="http://examples.etg.services.enbw.net/" >>>>>> serviceName="service:CustomerService" >>>>>> endpointName="service:CustomerServiceEndpoint" >>>>>> address="camel://direct:server" >>>>>> implementor="#serviceImpl"> >>>>>> <features> >>>>>> <!-- Enables logging of SOAP messages. --> >>>>>> <logging xmlns="http://cxf.apache.org/core" /> >>>>>> </features> >>>>>> </endpoint> >>>>>> >>>>>> <client id="customerService" xmlns="http://cxf.apache.org/jaxws" >>>>>> xmlns:service="http://examples.etg.services.enbw.net/" >>>>>> serviceName="service:CustomerService" >>>>>> endpointName="service:CustomerServiceEndpoint" >>>>>> >>>>>> >> >> serviceClass="net.enbw.services.etg.examples.customerservice.CustomerService >>>>>> >>>>>> V1" >>>>>> address="camel://direct:client"> >>>>>> <features> >>>>>> <!-- Enables logging of SOAP messages. --> >>>>>> <!-- logging xmlns="http://cxf.apache.org/core" >>>> >>>> /--> >>>>>> >>>>>> </features> >>>>>> </client> >>>>>> >>>>>> <camelContext id="camelContext" trace="false" >>>>>> xmlns="http://camel.apache.org/schema/spring"> >>>>>> <route> >>>>>> <from uri="direct:client"/> >>>>>> <to >>>>>> >> >> uri="jms://queue.net.enbw.services.etg.examples.customerservice.CustomerServ >>>>>> >>>>>> ice" /> >>>>>> </route> >>>>>> <route> >>>>>> <from >>>>>> >> >> uri="jms://queue.net.enbw.services.etg.examples.customerservice.CustomerServ >>>>>> >>>>>> ice" /> >>>>>> <transacted/> >>>>>> <to uri="direct:server" /> >>>>>> </route> >>>>>> </camelContext> >>>>>> >>>>>> <!-- See http://camel.apache.org/jms.html --> >>>>>> <bean id="jms" >>>>>> class="org.apache.camel.component.jms.JmsComponent"> >>>>>> <constructor-arg index="0"> >>>>>> <ref bean="jmsConfiguration" /> >>>>>> </constructor-arg> >>>>>> <property name="connectionFactory" >>>>>> ref="jmsConnectionFactory" /> >>>>>> </bean> >>>>>> <bean id="jmsConfiguration" >>>>>> class="org.apache.camel.component.jms.JmsConfiguration"> >>>>>> <property name="useMessageIDAsCorrelationID" value="true" >>>> >>>> /> >>>>>> >>>>>> <property name="acknowledgementModeName" >>> >>> value="TRANSACTED" >>>>>> >>>>>> /> >>>>>> <property name="explicitQosEnabled" value="true" /> >>>>>> <property name="receiveTimeout" >>>>>> value="${jms.receiveTimeout}" /> >>>>>> <property name="requestTimeout" >>>>>> value="${jms.requestTimeout}" /> >>>>>> <property name="recoveryInterval" >>>>>> value="${jms.recoveryInterval}" /> >>>>>> <property name="timeToLive" value="${jms.timeToLive}" /> >>>>>> <property name="transacted" value="true" /> >>>>>> <property name="transactedInOut" value="true" /> >>>>>> <property name="transactionManager" >>>>>> ref="jmsTransactionManager"/> >>>>>> </bean> >>>>>> >>>>>> <bean id="jmsTransactionManager" >>>>>> class="org.springframework.jms.connection.JmsTransactionManager"> >>>>>> <property name="connectionFactory" >>>>>> ref="jmsConnectionFactory" /> >>>>>> </bean> >>>>>> >>>>>> <!-- See Tibco EMS documentation --> >>>>>> <bean id="jmsConnectionFactory" >>>>>> class="com.tibco.tibjms.TibjmsConnectionFactory"> >>>>>> <property name="serverUrl" value="${jms.serverUrl}" /> >>>>>> <property name="userName" value="${jms.userName}" /> >>>>>> <property name="userPassword" value="${jms.userPassword}" >>>> >>>> /> >>>>>> >>>>>> <property name="reconnAttemptCount" >>>>>> value="${jms.reconnAttemptCount}" /> >>>>>> <property name="reconnAttemptDelay" >>>>>> value="${jms.reconnAttemptDelay}" /> >>>>>> </bean> >>>>>> >>>>>> </beans> >>>>>> >>>> >>> >> >> > > -- Claus Ibsen Apache Camel Committer Author of Camel in Action: http://www.manning.com/ibsen/ Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus |
| < Prev | 1 - 2 | Next > |
| Free embeddable forum powered by Nabble | Forum Help |