@Bean public IntegrationFlow routeSubflowToReplyChannelFlow() { return f -> f .<Boolean>route("true", m -> m .subFlowMapping(true, upperCase()) ); }
@Bean public IntegrationFlow routerTwoSubFlows() { return f -> f .split() .<Integer, Boolean>route(p -> p % 2 == 0, m -> m .subFlowMapping(true, sf -> sf.<Integer>handle((p, h) -> p * 2)) .subFlowMapping(false, sf -> sf.<Integer>handle((p, h) -> p * 3))) .aggregate() .channel(MessageChannels.queue("routerTwoSubFlowsOutput")); }
@Bean public IntegrationFlow exceptionTypeRouteFlow() { return f -> f .routeByException(r -> r .channelMapping(IllegalArgumentException.class, "illegalArgumentChannel") .channelMapping(RuntimeException.class, "runtimeExceptionChannel") .subFlowMapping(MessageHandlingException.class, sf -> sf.channel("messageHandlingExceptionChannel")) .defaultOutputChannel("exceptionRouterDefaultChannel")); }
@Bean public IntegrationFlow routeSubflowWithoutReplyToMainFlow() { return f -> f .<String, Boolean>route("BOO"::equals, m -> m .resolutionRequired(false) .subFlowMapping(true, sf -> sf .transform(String.class, String::toLowerCase) .channel(MessageChannels.queue("routerSubflowResult"))) .defaultSubFlowMapping(sf -> sf.channel("defaultOutputChannel"))); }
@Bean public IntegrationFlow routeFlow() { return IntegrationFlows.from("routerInput") .<Integer, Boolean>route(p -> p % 2 == 0, m -> m.channelMapping(true, "evenChannel") .subFlowMapping(false, f -> f.<Integer>handle((p, h) -> p * 3)) .defaultOutputToParentFlow()) .channel(MessageChannels.queue("oddChannel")) .get(); }
private RouterSpec<Boolean, MethodInvokingRouter> routeProducts(RouterSpec<Boolean, MethodInvokingRouter> mapping) { return mapping .subFlowMapping(true, sf -> sf.handle(productProcessor(), "fastProcess")) .subFlowMapping(false, sf -> sf.handle(productProcessor(), "process")); }
@Bean public IntegrationFlow routeSubflowToReplyChannelFlow() { return f -> f .<Boolean>route("true", m -> m .subFlowMapping(true, sf -> sf .<String>handle((p, h) -> p.toUpperCase()) ) ); }
@Bean public IntegrationFlow routerTwoSubFlows() { return f -> f .split() .<Integer, Boolean>route(p -> p % 2 == 0, m -> m .subFlowMapping(true, sf -> sf.<Integer>handle((p, h) -> p * 2)) .subFlowMapping(false, sf -> sf.<Integer>handle((p, h) -> p * 3))) .aggregate() .channel(c -> c.queue("routerTwoSubFlowsOutput")); }
@Bean public IntegrationFlow routeSubflowWithoutReplyToMainFlow() { return f -> f .<String, Boolean>route("BOO"::equals, m -> m .resolutionRequired(false) .subFlowMapping(true, sf -> sf .transform(String.class, String::toLowerCase) .channel(c -> c.queue("routerSubflowResult"))) .defaultSubFlowMapping(sf -> sf.channel("defaultOutputChannel"))); }
@Bean public IntegrationFlow routeFlow() { return IntegrationFlows.from("routerInput") .<Integer, Boolean>route(p -> p % 2 == 0, m -> m.channelMapping(true, "evenChannel") .subFlowMapping(false, f -> f.<Integer>handle((p, h) -> p * 3)) .defaultOutputToParentFlow()) .channel(c -> c.queue("oddChannel")) .get(); }