Hi 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: [email protected]

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:[email protected]] 
Gesendet: Montag, 2. November 2009 13:08
An: [email protected]
Betreff: Re: Problem with SOAP/JMS and transactions

On Mon, Nov 2, 2009 at 12:02 PM, Schneider Christian
<[email protected]> 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: [email protected]
>
> 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

Reply via email to