camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "abhijeet.bongarde" <abhijeet.bonga...@synerzip.com>
Subject TimeToLive property not working in case of DynamicRouter
Date Tue, 25 Feb 2014 06:43:04 GMT
Hi,
I am trying to implement TimeToLive for the topic messages using camel
router.
I have two types of topics one is declared through camel.xml and other is
using DynamicRouter.java
Here is the code snippet for reference:
code in camel.xml:
&lt;from uri="activemq:queue:jpaLogQueue"/&gt;
&lt;multicast&gt;
    &lt;pipeline&gt;
	
&lt;to uri="activemq:topic:jpaLogTopic?timeToLive=60000" /&gt;

    &lt;/pipeline&gt;
    &lt;pipeline&gt;
        &lt;aggregate strategyRef="jpaAggregatorStrategy"
eagerCheckCompletion="true" completionTimeout="5000"&gt;
       &lt;correlationExpression&gt;
          
&lt;simple&gt;${in.headers[__EclipseLinkSessionId__]}&lt;/simple&gt;
       &lt;/correlationExpression&gt;
       &lt;completionPredicate&gt;
             &lt;simple&gt;${body} contains 'commit_transaction' || ${body}
contains 'release_unit_of_work'                   &lt;/simple&gt;
       &lt;/completionPredicate&gt;
       &lt;process ref="scrapMessageFilterProcessor"/&gt;
       &lt;process ref="transactionalMarkerProcessor"/&gt;
       &lt;choice&gt;
             &lt;when&gt;
                      &lt;simple&gt;
${in.headers[Transactional]} == "true" </simple&amp;gt;&lt;br>             
       
&lt;process ref="jpaSqlMessageTransformer"/&gt;
                    &lt;dynamicRouter&gt;
  
                          &lt;method ref="DynamicRouter" method="route"/&gt;
 
 
                    &lt;/dynamicRouter&gt;
 
	          &lt;/when&gt;
            &lt;otherwise&gt;
                    &lt;to uri="activemq:queue:ActiveMQ.DLQ"/&gt;
             &lt;/otherwise&gt;
      &lt;/choice&gt;
      &lt;/aggregate&gt;
				      &lt;/pipeline&gt;
     &lt;/multicast&gt;
&lt;/route&gt;

Code for DynamicRouter:

public String route(@Body String body, Exchange exchange, Message msg,
			@Header(Exchange.SLIP_ENDPOINT) String previous,@Properties Map<String,
Object> properties) {

*return "activemq:topic: jpa.modelName.vdbVersion-name?timeToLive=60000";*
}

The property TimeToLive given in the xml creates a topic with message expiry
time as 1 minute but if I provide same property to a Topic created through
Dynamic router, 
it doesn't  honour the timetolive and messages from that topic doesnt expire
after 1 minute.

Is there anything which I am missing out or is there any other way out to
accomplish it?

Thanks,
Abhijeet.
 



--
View this message in context: http://camel.465427.n5.nabble.com/TimeToLive-property-not-working-in-case-of-DynamicRouter-tp5747895.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message