camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From suralk <>
Subject how to share variables among different exchanges
Date Thu, 04 Oct 2012 02:20:40 GMT
Hi All,
I have camel zookeeper that generates a unique node id for me, and I want to
use this id as the name of the jms queue in a different route. I tried to
use a static variable to store this id as shown below, but it is not working
(converting this static variable to an instance variable also does not
work). It (I think) is because the initialization of the static variable is
done inside the inner class Processor(). How can I achieve this
functionality? One option is to store the variable in a camel
SimpleDirectory, but then how can this directory entry be accessed inside
the from("jms:" + <get from registry>)?

public class MyRouteBuilder extends RouteBuilder {
	static String routeId="";
    public void configure() {
 	       .process(new Processor() {
             	public void process(Exchange exchange) throws Exception {
             	   routeId = exchange.getIn().getBody(String.class);	
 	   from("jms:" + routeId) 	  

View this message in context:
Sent from the Camel - Users mailing list archive at

View raw message