protected CamelContext createCamelContext(String name, String managementPattern) throws Exception { DefaultCamelContext context = new DefaultCamelContext(); context.setName(name); if (managementPattern != null) { context.getManagementNameStrategy().setNamePattern(managementPattern); } return context; }
@Override protected JndiRegistry createRegistry() throws Exception { JndiRegistry registry = super.createRegistry(); // lets create our black box as a camel context and a set of routes DefaultCamelContext blackBox = new DefaultCamelContext(registry); blackBox.setName("blackBox"); blackBox.addRoutes( new RouteBuilder() { @Override public void configure() throws Exception { // receive purchase orders, lets process it in some way then // send an invoice to our invoice endpoint from("direct:purchaseOrder") .setHeader("received") .constant("true") .to("direct:invoice"); } }); blackBox.start(); registry.bind("accounts", blackBox); return registry; }