in generic-examples/databases/H2DBMultiDatasources.java [34:66]
public void configure() throws Exception {
from("timer://initCamel?repeatCount=1")
.routeId("Init")
.log("Create table defaultcamel")
.to("sql:CREATE TABLE defaultcamel (id SERIAL PRIMARY KEY, timestamp VARCHAR(255))?dataSource=#default")
.to("log:DEBUG?showBody=true&showHeaders=true")
.log("SUCCESS Create table defaultcamel")
.log("Create table testingcamel")
.to("sql:CREATE TABLE testingcamel (id SERIAL PRIMARY KEY, timestamp VARCHAR(255))?dataSource=#testing")
.to("log:DEBUG?showBody=true&showHeaders=true")
.log("SUCCESS Create table testingcamel");
from("timer://insertCamel?period=1000&delay=5000")
.routeId("Insert")
.log("Inserting defaultcamel ${messageTimestamp}")
.setBody().simple("INSERT INTO defaultcamel (timestamp) VALUES (${messageTimestamp})")
.to("jdbc:default")
.log("Inserted defaultcamel ${messageTimestamp}")
.log("Inserting testingcamel ${messageTimestamp}")
.setBody().simple("INSERT INTO testingcamel (timestamp) VALUES (${messageTimestamp})")
.to("jdbc:testing")
.log("Inserted testingcamel ${messageTimestamp}");
from("timer://selectCamel?period=1000&delay=5000")
.routeId("Test")
.to("sql:SELECT * FROM defaultcamel?dataSource=#default")
.to("log:DEBUG?showBody=true&showHeaders=true")
.to("sql:SELECT * FROM testingcamel?dataSource=#testing")
.to("log:DEBUG?showBody=true&showHeaders=true")
.setBody().simple("SUCCESS");
}