I want a child route to run from a Timer route but the following code is not running properly:
Child route:
from("direct:processOrder").id("dd")
// .setBody(constant("select * from customer"))
// .to("jdbc:testdb")
.to("sql:select * from EMPLOYEE?dataSource=masterdata")
.log(LoggingLevel.INFO, "DB")
.to("log:?level=INFO&showBody=true").end();
Main route:
from("timer://foo?period=30000")
.log(LoggingLevel.INFO, "Triggered Company")
.process(new Processor() {
public void process(Exchange exchange) throws Exception {
exchange.getContext().startRoute("dd");
}
})
.end();
Output:
20/03/05 13:28:07 INFO impl.DefaultCamelContext: StreamCaching is not in use. If using streams then its recommended to enable stream caching. See more details at http://camel.apache.org/stream-caching.html
20/03/05 13:28:08 INFO impl.DefaultCamelContext: Route: dd started and consuming from: Endpoint[direct://processOrder]
20/03/05 13:28:08 INFO impl.DefaultCamelContext: Route: route1 started and consuming from: Endpoint[timer://foo?period=30000]
20/03/05 13:28:08 INFO impl.DefaultCamelContext: Total 2 routes, of which 2 is started.
20/03/05 13:28:08 INFO impl.DefaultCamelContext: Apache Camel 2.15.1 (CamelContext: camel-1) started in 0.400 seconds
20/03/05 13:28:09 INFO route1: Triggered Company
20/03/05 13:28:09 INFO impl.DefaultCamelContext: Route: dd started and consuming from: Endpoint[direct://processOrder]
What component to be used in from
of the child route so that it just runs when we .startRoute
from the main route program?