@Override public void configure() throws Exception { from("ref:sampleSql") .setBody(constant("SELECT SYSDATE FROM DUAL")) .to("jdbc:hades_PC1_PC2") .split(body()) .log(LoggingLevel.INFO, SampleSqlRouteBuilder.class.getName(), "date: ${body[SYSDATE]}"); } }
@Override public void configure() throws Exception { from("direct:start") .split(xpath("//invoice/item/product")) .convertBodyTo(String.class) .to("mock:products") .end() .to("mock:result"); } }
@Override public void configure() throws Exception { from(inputPath) .routeId(getRouteId()) .split(body().tokenize("\n")) .convertBodyTo(UpdateInventoryInput.class) .to("direct:update"); }
protected RouteDefinition appendSplitterRoutes(RouteDefinition route) throws Exception { //NOSONAR // Splitter (optional) if (routeConfig.getSplitStrategy() != null) { addInterimProc(route.split(splitExpression())). parallelProcessing(). to(endpoints.getSplitUri()). routeId(endpoints.getSplitRouteId()); return from(endpoints.getSplitUri()); } return route; }
@Override public void configure() throws Exception { // this is the file route which is started 2nd last from("file://target/inventory/updates") .routeId("file").startupOrder(2) .split(body().tokenize("\n")) .convertBodyTo(UpdateInventoryInput.class) .to("direct:update"); // this is the shared route which then must be started first from("direct:update") .routeId("update").startupOrder(1) .to("bean:inventoryService?method=updateInventory"); } }
@Override public void configure() throws Exception { // this is the webservice route which is started last from("cxf:bean:inventoryEndpoint") .routeId("webservice").startupOrder(3) .to("direct:update") .transform().method("inventoryService", "replyOk"); // this is the file route which is started 2nd last from("file://target/inventory/updates") .routeId("file").startupOrder(2) .split(body().tokenize("\n")) .convertBodyTo(UpdateInventoryInput.class) .to("direct:update"); // this is the shared route which then must be started first from("direct:update") .routeId("update").startupOrder(1) .to("bean:inventoryService?method=updateInventory"); } }
@Override public void configure() throws Exception { // this is the webservice route which is started last from("cxf:bean:inventoryEndpoint") .routeId("webservice").startupOrder(3) .to("direct:update") .transform().method("inventoryService", "replyOk"); // this is the file route which is started 2nd last from("file://target/inventory/updates") .routeId("file").startupOrder(2) .split(body().tokenize("\n")) .convertBodyTo(UpdateInventoryInput.class) .to("direct:update"); // this is the shared route which then must be started first from("direct:update") .routeId("update").startupOrder(1) .to("bean:inventoryService?method=updateInventory"); } }
.autoStartup(true) .process(importConfigByFileNameProcessor) .split(bodyAs(String.class).tokenize("${in.header.importConfigOneShot.getLineSeparator}")) .setHeader(RouterConstants.HEADER_CONFIG_TYPE, constant(configType)) .process(lineSplitProcessor)
@Override public void configure() throws Exception { // this is the webservice route which is started last from("cxf:bean:inventoryEndpoint") .routeId("webservice").startupOrder(3) .to("direct:update") .transform().method("inventoryService", "replyOk"); // this is the file route which is started 2nd last from("file://target/inventory/updates") .routeId("file").startupOrder(2) .split(body().tokenize("\n")) .convertBodyTo(UpdateInventoryInput.class) .to("direct:update"); // this is the shared route which then must be started first from("direct:update") .routeId("update").startupOrder(1) .to("bean:inventoryService?method=updateInventory"); } }
@Override public void configure() { String state = container.getState(); CamelProcessor terminatingMailetProcessor = new CamelProcessor(metricFactory, container, new TerminatingMailet()); RouteDefinition processorDef = from(container.getEndpoint()) .routeId(state) .setExchangePattern(ExchangePattern.InOnly); for (MatcherMailetPair pair : pairs) { CamelProcessor mailetProccessor = new CamelProcessor(metricFactory, container, pair.getMailet()); MatcherSplitter matcherSplitter = new MatcherSplitter(metricFactory, container, pair); processorDef // do splitting of the mail based on the stored matcher .split().method(matcherSplitter) .aggregationStrategy(new UseLatestAggregationStrategy()) .process(exchange -> handleMailet(exchange, container, mailetProccessor)); } processorDef .process(exchange -> terminateSmoothly(exchange, container, terminatingMailetProcessor)); }
@Override public void configure() throws Exception { // this is the webservice route which is started last from("cxf:bean:inventoryEndpoint") .routeId("webservice").startupOrder(3) .to("direct:update") .transform().method("inventoryService", "replyOk"); // this is the file route which is started 2nd last from("file://target/inventory/updates") .routeId("file").startupOrder(2) .split(body().tokenize("\n")) .convertBodyTo(UpdateInventoryInput.class) .to("direct:update"); // this is the shared route which then must be started first from("direct:update") .routeId("update").startupOrder(1) .to("bean:inventoryService?method=updateInventory"); } }
@Override public void configure() throws Exception { // this is the webservice route which is started last from("cxf:bean:inventoryEndpoint") .routeId("webservice").startupOrder(3) .to("direct:update") .transform().method("inventoryService", "replyOk"); // this is the file route which is started 2nd last from("file://target/inventory/updates") .routeId("file").startupOrder(2) .split(body().tokenize("\n")) .convertBodyTo(UpdateInventoryInput.class) .to("direct:update") .end(); // this is the shared route which then must be started first from("direct:update") .routeId("update").startupOrder(1) .to("bean:inventoryService?method=updateInventory"); } }
@Override public void configure() throws Exception { // this is the webservice route which is started last from("cxf:bean:inventoryEndpoint") .routeId("webservice").startupOrder(3) .to("direct:update") .transform().method("inventoryService", "replyOk"); // this is the file route which is started 2nd last from("file://target/inventory/updates") .routeId("file").startupOrder(2) .split(body().tokenize("\n")) .convertBodyTo(UpdateInventoryInput.class) .to("direct:update"); // this is the shared route which then must be started first from("direct:update") .routeId("update").startupOrder(1) // we must defer shutting down this route as its a shared route by the two others .shutdownRoute(ShutdownRoute.Defer) .to("bean:inventoryService?method=updateInventory"); } }
@Override public void configure() throws Exception { // this is the webservice route which is started last from("cxf:bean:inventoryEndpoint") .routeId("webservice").startupOrder(3) .to("direct:update") .transform().method("inventoryService", "replyOk"); // this is the file route which is started 2nd last from("file://target/inventory/updates") .routeId("file").startupOrder(2) .split(body().tokenize("\n")) .convertBodyTo(UpdateInventoryInput.class) .to("direct:update") .end(); // this is the shared route which then must be started first from("direct:update") .routeId("update").startupOrder(1) .to("bean:inventoryService?method=updateInventory"); } }
@Override public void configure() throws Exception { // this is the webservice route which is started last from("cxf:bean:inventoryEndpoint") .routeId("webservice").startupOrder(3) .to("direct:update") .transform().method("inventoryService", "replyOk"); // this is the file route which is started 2nd last from("file://target/inventory/updates") .routeId("file").startupOrder(2) .split(body().tokenize("\n")) .convertBodyTo(UpdateInventoryInput.class) .to("direct:update") .end(); // this is the shared route which then must be started first from("direct:update") .routeId("update").startupOrder(1) .to("bean:inventoryService?method=updateInventory"); } }
@Override public void configure() throws Exception { // this is the webservice route which is started last from("cxf:bean:inventoryEndpoint") .routeId("webservice").startupOrder(3) .to("direct:update") .transform().method("inventoryService", "replyOk"); // this is the file route which is started 2nd last from("file://target/inventory/updates") .routeId("file").startupOrder(2) .split(body().tokenize("\n")) .convertBodyTo(UpdateInventoryInput.class) .to("direct:update"); // this is the shared route which then must be started first from("direct:update") .routeId("update").startupOrder(1) // we must defer shutting down this route as its a shared route by the two others .shutdownRoute(ShutdownRoute.Defer) .to("bean:inventoryService?method=updateInventory"); } }
@Override public void configure() throws Exception { from("file:ordersin?noop=true").id("order") .setHeader("customer", xpath("/order/customer/text()").stringResult()) .split(xpath("/order/item")) .setHeader("count", xpath("/item/@count").stringResult()) .setHeader("name", xpath("/item/@name").stringResult()) .choice() .when(xpath("/item/@vendor != 'direct'")).to("direct:vendor") .otherwise().recipientList(simple("file:ordersout/${header.customer}")); from("direct:vendor").id("mailtovendor") .setHeader("to", method("vendorMailService")) .setHeader("subject", simple("Order from ${header.customer}")) .to("velocity:mailtemplate.txt") .to("stream:out") .to("smtp:{{mailserver}}"); } }
@Override public void configure() { from("direct:start") .id("start") .routePolicy(new ActivityTrackingPolicy(activityTracker)) .split() .body() .process(OutMessageCaptureProcessor.INSTANCE) .pipeline() .id("log") .log(LoggingLevel.INFO, "log", "log", "hi") .process(OutMessageCaptureProcessor.INSTANCE) .end() .pipeline() .id("rnderr") .process().body(String.class, body -> { if ("error".equals(body)) { throw new RuntimeException("Bean Error"); } }) .process(OutMessageCaptureProcessor.INSTANCE) .end() .pipeline() .id("end") .to("mock:end") .process(OutMessageCaptureProcessor.INSTANCE) .end() .end(); } });
@Override public void configure() throws Exception { // use vertx instance on the Camel vertx component getContext().getComponent("vertx", VertxComponent.class).setVertx(vertx); // initialize the list of games which is called when a new client connects to Vert.X backend from("direct:init-games").routeId("init-games") .log("Init games event") .to("goal:games.csv") // the frontend expect one message per game so split .split(body()) .to("vertx:games"); // the route for handling live score updates from the goal // component which is published to vertx addresses from("goal:goals.csv").routeId("livescore").autoStartup(false) .log("Goal event: ${header.action} -> ${body}") .choice() .when(header("action").isEqualTo("clock")) .to("vertx:clock") .when(header("action").isEqualTo("goal")) .to("vertx:goals"); // consume from vertx control address when the user clicks the control buttons // then we want to start/suspend the livescore route accordingly from("vertx:control").routeId("control") .log("Control event: ${body}") .toD("controlbus:route?routeId=livescore&async=true&action=${body}"); }