@Override public void configure() throws Exception { from("direct:start") .split(xpath("//invoice/item/product")) .convertBodyTo(String.class) .to("mock:products") .end() .to("mock:result"); } }
public static SplitDefinition aggregationStrategy(SplitDefinition self, Closure<Exchange> aggregationLogic) { return self.aggregationStrategy(toAggregationStrategy(aggregationLogic)); }
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() { 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 { // 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}"); }
@Override public Optional<ProcessorDefinition> handle(Split step, ProcessorDefinition route, SyndesisRouteBuilder routeBuilder) { CamelContext context = routeBuilder.getContext(); Expression expression = JsonSimpleHelpers.getMandatoryExpression(context, step, step.getExpression()); ProcessorDefinition split = route.split(expression).marshal().json(JsonLibrary.Jackson); routeBuilder.addSteps(split, step.getSteps()); return Optional.empty(); } }
@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]}"); } }
.bean(collectProfileBean, "extractProfileBySegment(" + exportConfiguration.getProperties().get("segment") + ")") .split(body()) .marshal(jacksonDataFormat) .convertBodyTo(String.class) .setHeader(RouterConstants.HEADER_EXPORT_CONFIG, constant(exportConfiguration))
.log(LoggingLevel.DEBUG, "Splitted into ${exchangeProperty.CamelSplitSize} records") .setHeader(RouterConstants.HEADER_CONFIG_TYPE, constant(configType)) .process(lineSplitProcessor)
@Override public void configure() throws Exception { from(inputPath) .routeId(getRouteId()) .split(body().tokenize("\n")) .convertBodyTo(UpdateInventoryInput.class) .to("direct:update"); }
final Expression expression = language.createExpression(expressionDefinition); route = route.split(expression).aggregationStrategy(new UseOriginalAggregationStrategy(null, false));
@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"); } }
@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"); } }
@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"); } }