I managed to get it work this way: In the camel.xml I declared my bean:
<bean id="myDb" class="com.mongodb.Mongo" /> my route: from("jms:mongoQueue") .bean(MongoConnection.class, "setConnectionBean") .process(new Processor() { @Override public void process(Exchange exchange) throws Exception { exchange.getIn().setHeader(MongoDbConstants.DATABASE, "dbname"); exchange.getIn().setHeader(MongoDbConstants.COLLECTION, "collection"); exchange.getIn().setHeader(MongoDbConstants.OPERATION_HEADER, "operation"); exchange.getIn().setBody(query); } }) .dynamicRouter(method(MongoConnection.class, "getConnection")) and the MongoConnection.class: @Autowired private Mongo mongo; public String getConnection(String body, @Header(Exchange.SLIP_ENDPOINT) String previous) throws Exception{ if(previous == null) return "mongodb://myDb?database=none&collection=none&dynamicity=true"; else return null; } public void setConnectionBean(MongoStep step) throws UnknownHostException{ MongoClientURI uri = new MongoClientURI(getUri()); mongo = new MongoClient(uri); } Now I can specify the uri in the runtime. -- View this message in context: http://camel.465427.n5.nabble.com/mongoDB-uri-tp5755565p5755704.html Sent from the Camel - Users mailing list archive at Nabble.com.