Mike
Mike

Reputation: 635

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

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}

Upvotes: 0

Views: 60

Answers (1)

Claus Ibsen
Claus Ibsen

Reputation: 56082

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.

Upvotes: 0

Related Questions