camel delayer with transaction/reliablity

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

camel delayer with transaction/reliablity

magellings
Hello.  When using the camel delayer the camel consumer takes a message off the queue and sleeps the specified time.  You can see in the web console that the messages received column indicates a message was received, it then waits X amount of time, and then forwards the message to the destination queue.

From what I understand, this should be done in a transaction so as if during the sleep the broker goes down the message isn't lost.  This is not the case.  For me if I stop the broker the message is indeed lost.  This becomes more of a problem when you are dealing with longer sleep times (e.g. 60 minutes).

Should the camel delayer be consuming inside a transaction by default?  If not is there a way to configure this in the activemq configuration?

My current configuration:

<camelContext id="camel" xmlns="http://activemq.apache.org/camel/schema/spring">
 
     
     
 
     
     
     <route>
       <from uri="activemq:delayedSyncQueue"/>
       <delayer>
         <simple>header.delayme</simple>
         <to uri="activemq:syncQueue21"/>
       </delayer>
     </route>

   </camelContext>
 
   
 
   
   <bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent" >
     <property name="connectionFactory">
       <bean class="org.apache.activemq.ActiveMQConnectionFactory">
         <property name="brokerURL" value="vm://localhost?create=false&amp;waitForStart=10000" />
         <property name="userName" value="${activemq.username}"/>
         <property name="password" value="${activemq.password}"/>
       </bean>
     </property>
   </bean>
Reply | Threaded
Open this post in threaded view
|

Re: camel delayer with transaction/reliablity

magellings
got this one figured out...

just add the transacted = true property.  must default to auto or client acknowledgement...this sets it to a transactional session.

<bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent" >
     <property name="connectionFactory">
       <bean class="org.apache.activemq.ActiveMQConnectionFactory">
         <property name="brokerURL" value="vm://localhost?create=false&amp;waitForStart=10000" />
         <property name="userName" value="${activemq.username}"/>
         <property name="password" value="${activemq.password}"/>
       </bean>
     </property>
     <property name="transacted" value="true"/>
   </bean>

there's actually a lot of properties I'm assuming can be set...albeit haven't tested any other ones.

http://camel.apache.org/maven/camel-jms/apidocs/org/apache/camel/component/jms/JmsComponent.html