Adding a varibale to the RouteDefination "from " in Apache camel

60 Views Asked by At

I am looking to amend the RouteDefination from in Apache Camel

I hav eproperties file as below test1=test queue1=queue

code as below

from( "activemq:queue:{{test1}}.{{queue1}}")
.transform()
.simple(" ${body} {{test1}}.{{queue1}}.hello ${date:now:yyyyMMdd}")
.to("stream:out");

this will become for route as

from( "activemq:queue:test1.queue")

i am looking to make it as

from( "activemq:queue:test1.queue_20170606")

which is ${date:now:yyyyMMdd}

1

There are 1 best solutions below

0
Claus Ibsen On

This is not possible in Camel - the from endpoint is static.

However ActiveMQ supports queue wildcards which you can use to consume from multiple queues, and you can use JMS message selectors.

The latter is not so performant as it needs to do a query on the queue.

If you want to do a route per yyyyMMdd, then you need to add/remove routes dynamic in Camel. See other questions on SO how to do that.