activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sanjay Jain <sanjai...@gmail.com>
Subject Redelivery of messages in transactional mode
Date Tue, 05 May 2009 15:06:38 GMT

Hi All,

I tried hard to get the redelivery working when route is transacted. But so
far no luck with redelivery at all. I am using camel-1.5.0 in servicemix
3.2.2. 

This is how my camel-context.xml looks like:

<camelContext id="camel" useJmx="false" 
xmlns="http://activemq.apache.org/camel/schema/spring">
<route errorHandlerRef="transactionErrorHandler">
        <route>
              <from uri="activemq:topic:StatelessTransactions"/>
              <policy ref="required" />
              <bean ref="RouteBuilder" method="throwRetryException" />
</route>
</camelContext>

<bean id="jms" class="org.apache.camel.component.jms.JmsComponent">
                <property name="connectionFactory"
ref="jmsConnectionFactory">
                 </property>
                <!-- define the jms consumer/producer as transacted -->
                <property name="transacted" value="true"/>
                <property name="transactionManager"
ref="jmsTransactionManager"/>
</bean>

 <bean id="activemq"
class="org.apache.activemq.camel.component.ActiveMQComponent">
            <property name="brokerURL" value="vm://localhost?create=false"
/>
</bean>

<bean id="RouteBuilder" class="com.RouteBuilder"/>

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

<bean id="jmsConnectionFactory"
class="org.apache.activemq.ActiveMQConnectionFactory">
      <property name="brokerURL"
value="vm://localhost?broker.persistent=false&amp;broker.useJmx=false"/>
       <property name="redeliveryPolicy" ref="redeliveryPolicy" />
</bean>

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

 <bean id="redeliveryPolicy" class="org.apache.activemq.RedeliveryPolicy">
             <property name="maximumRedeliveries" value="-1"/>
 </bean>

  <bean id="PROPAGATION_NOT_SUPPORTED"
class="org.springframework.transaction.support.TransactionTemplate">
            <property name="transactionManager" ref="jmsTransactionManager"
/>
            <property name="propagationBehaviorName"
value="PROPAGATION_NOT_SUPPORTED" />
 </bean>

  <bean id="PROPAGATION_REQUIRES_NEW"
class="org.springframework.transaction.support.TransactionTemplate">
            <property name="transactionManager" ref="jmsTransactionManager"
/>
            <property name="propagationBehaviorName"
value="PROPAGATION_REQUIRES_NEW" />
  </bean>

<bean id="transactionErrorHandler"
class="org.apache.camel.spring.spi.TransactionErrorHandlerBuilder">
            <property name="transactionTemplate"
ref="PROPAGATION_REQUIRED"/>
 </bean>

Class RouteBuilder{
 public void throwRetryException() throws Exception{
        throw new Exception();
    }
};

No matter whatever I do, I never seen camel to trigger the redelivery of
messages. 

I also came across this wiki page :
http://camel.apache.org/transactional-client.html and here it says:

Configuration of Redelivery

The redelivery in transacted mode is not handled by Camel but by the backing
system (the transaction manager). In such cases you should resort to the
backing system how to configure the redelivery. 

As far as I understand, the backing system in my configuration is ActiveMQ
TransactionManager which I set correctly. If I am wrong please someone
correct me here and also give me explanation about backing system.

Could anyone please tell me what I am missing here?

I struggled a lot but never get this working. I am dying to see this working
as soon as I can.

Looking forward to see your expert comments.

Thanks in advance,
Sanjay




-- 
View this message in context: http://www.nabble.com/Redelivery-of-messages-in-transactional-mode-tp23389382p23389382.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Mime
View raw message