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