Hi, As new guy in the Camel world i'm stuck in a problem. I want to create tables in my database based on the header of the url. This is done... The problem is when i generate multiple "gets" it only creates one.... I had to put a thread sleep and slow-it down to 1 second per request... The route is answered and it passes the queue but no table is created...
*Route to process:* from("jetty:http://localhost:8080/Middleware") .streamCaching() .choice() .when(header("foo").isEqualTo("bar")).to("activemq:queue:myQueue?explicitQosEnabled=true&priority=9") .when(header("createdb")).process(Createtable) .end() *Processor* public class CreateTable implements Processor { String value=null; ProducerTemplate producer; String Head; public void setProducer(ProducerTemplate producer) { this.producer = producer; } public void process(Exchange inExchange) throws Exception { Head=inExchange.getIn().getHeader("createdb").toString(); ApplicationContext appContext = new ClassPathXmlApplicationContext("camelDatabase-context.xml"); CamelContext camelContext = SpringCamelContext.springCamelContext( appContext, false); camelContext.addRoutes(route()); camelContext.start(); ProducerTemplate template = camelContext.createProducerTemplate(); template.sendBody("activemq:queue:DBQueue?explicitQosEnabled=true&priority=9", "Hello Camel"); System.out.println(Head); } public RouteBuilder route() { return new RouteBuilder() { public void configure() { // you can configure the route rule with Java DSL here System.out.println(Head); from("activemq:queue:DBQueue?explicitQosEnabled=true&priority=9") .to("sql: create table if not exists "+Head+" (" + "date_time TEXT," + "House_Consumption DOUBLE," + "PV DOUBLE," + "Wind DOUBLE" + ")") ; } }; } } Thanks for the help. -- View this message in context: http://camel.465427.n5.nabble.com/MySql-Data-Base-creation-tp5768535.html Sent from the Camel - Users mailing list archive at Nabble.com.