Hi Raul,
Thank you very much. It worked!
Here's my code, if somebody gets the same question in the future:

the custom RouteBuilder class: 
public class MyRouteBuilder extends RouteBuilder {
        String routeId;
        
        public MyRouteBuilder(String routeId)
        {
                this.routeId = routeId;
        }
        @Override
    public void configure() {     
        
           from("jms:"+routeId)           
           .to("jason:belief");
    }
}

Inside the camel context:
 camel.addRoutes(new RouteBuilder() {
                        
                   @Override
                   public void configure() {
                          
                           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 {
                                           String routeId =
exchange.getIn().getBody(String.class);         
                                           routeId = 
routeId.substring(routeId.indexOf("0"));                                     
                                           RouteBuilder rb = new 
MyRouteBuilder(routeId);
                                           CamelContext c = 
exchange.getContext();
                                           c.addRoutes(rb);
                                        }
                                });
}



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

Reply via email to