camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From suralk <sura.mon...@yahoo.com>
Subject how to dynamically set the jms queue name
Date Thu, 04 Oct 2012 06:22:38 GMT
Hi All,
This is my use case:
I have several camel contexts deployed independently. I use camel zookeeper
component to dynamically assign unique ids to these contexts:

static String routeId;

from("direct:start")
.to(ExchangePattern.InOut,

"zookeeper://127.0.0.1:2181/routers/router?create=true&createMode=EPHEMERAL_SEQUENTIAL")
   .process(new Processor() {
	public void process(Exchange exchange) throws Exception {
	 routeId =<znode id>;
		                	   
	}
 });

This routeId  is kept as a static variable.

Now i want to use this static routeId value to set the name of the jms
queue.
When jms queue is the producer, this works:

 from("jason:message")
 .process(new Processor() {
public void process(Exchange exchange) throws Exception {
	exchange.getIn().setHeader("CamelJmsDestinationName", routeId);
	}
    })
 .to("jms:dummy");	

However, what I want is to set the queue name of the consumer jms endpoint,     
from("jms:" + routeId)    	   
.to(...something...).

How can I achieve this? Initially I thought that from("jms:" + routeId)
would work. But it doesn't because the value for routeId is not available at
design time.
Can somebody please tell me how this could be done?

/Sura



--
View this message in context: http://camel.465427.n5.nabble.com/how-to-dynamically-set-the-jms-queue-name-tp5720527.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message