camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From leroykendall <leroykend...@yahoo.com>
Subject Re: JMS transaction behavior inside of route
Date Thu, 25 Apr 2013 21:01:39 GMT
Hi Claus,

Thank you for the link to the great page.
One issue that I've stuck is how to perform JMS redelivery in Camel using
Spring orchestrated transactions.
My spring context is:

    <bean id="camelJmsComponent"
class="org.apache.camel.component.jms.JmsComponent">
        <property name="transacted" value="true"/>
        <property name="transactionManager" ref="jmsTransactionManager"/>
        <property name="concurrentConsumers" value="1"/>
        <property name="connectionFactory" ref="jmsConnectionFactory"/>
    </bean>

    <bean id="jmsTransactionManager"
class="org.springframework.jms.connection.JmsTransactionManager">
        <property name="connectionFactory" ref="jmsConnectionFactory"/>
    </bean>

    <bean id="jmsConnectionFactory"
class="org.apache.activemq.pool.PooledConnectionFactory">
        <property name="connectionFactory" ref="amqConnectionFactory"/>
    </bean>

    <bean id="amqConnectionFactory"
class="org.apache.activemq.ActiveMQConnectionFactory">
        <property name="brokerURL" value="tcp://localhost:3303"/>
        <property name="redeliveryPolicy" ref="amqRedeliveryPolicy"/>
    </bean>

    <bean id="amqRedeliveryPolicy"
class="org.apache.activemq.RedeliveryPolicy">
        <property name="useExponentialBackOff" value="true"/>
        <property name="backOffMultiplier" value="2"/>
        <property name="initialRedeliveryDelay" value="1000"/>
        <property name="maximumRedeliveries" value="5"/>
    </bean>

    <bean id="PROPAGATION_REQUIRED"
          class="org.apache.camel.spring.spi.SpringTransactionPolicy">
        <property name="transactionManager" ref="jmsTransactionManager"/>
    </bean>

    <bean id="illegalArgumentException"
class="java.lang.IllegalArgumentException"/>

    <bean id="handlerBean" class="com.playtech.ums.tests.JmsHandlerBean"/>

    <camel:camelContext>

        <camel:route>
            <camel:from uri="jms:queue:test.lab.queue"/>
            <camel:transacted ref="PROPAGATION_REQUIRED"/>
            <camel:log message="Redelivered: ${header.JMSRedelivered}"/>
            <camel:choice>
                <camel:when>
                    <camel:simple>${in.body} contains
'exception'</camel:simple>
                    <camel:log message="Incoming message contains
'exception': ${in.body}" loggingLevel="WARN"/>
                    <camel:throwException ref="illegalArgumentException"/>
                </camel:when>
            </camel:choice>
            <camel:to uri="handlerBean"/>
        </camel:route>

    </camel:camelContext>

When I executed this code I've got message "Exhausted after delivery
attempt: 1" instead of "exponential back off" redelivery.
Could you please help?

Thanks.
--Victor



--
View this message in context: http://camel.465427.n5.nabble.com/JMS-transaction-behavior-inside-of-route-tp5730513p5731566.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message