@Bean public IntegrationFlow payloadTypeRouteFlow() { return f -> f .<Object, Class<?>>route(Object::getClass, m -> m .channelMapping(String.class, "stringsChannel") .channelMapping(Integer.class, "integersChannel")); }
@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 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(); }
@Bean public IntegrationFlow myFlow() throws IOException { return IntegrationFlows.from(feedMessageSource()) //4 .<SyndEntry, String> route(payload -> payload.getCategories().get(0).getName(),//5 mapping -> mapping.channelMapping("releases", "releasesChannel") //6 .channelMapping("engineering", "engineeringChannel") .channelMapping("news", "newsChannel")) .get(); // 7 }
@Bean public IntegrationFlow payloadTypeRouteFlow() { return f -> f .<Object, Class<?>>route(Object::getClass, m -> m .channelMapping(String.class, "stringsChannel") .channelMapping(Integer.class, "integersChannel")); }
@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(); }