/** * Populate the {@link AggregatingMessageHandler} with default options. * @return the current {@link IntegrationFlowDefinition}. */ public B aggregate() { return aggregate(null); }
@Bean public IntegrationFlow publishSubscribeAggregateFlow() { return flow -> flow .aggregate(a -> a.outputProcessor(g -> g.getMessages() .stream() .map(m -> (String) m.getPayload()) .collect(Collectors.joining(" ")))) .channel(MessageChannels.queue("subscriberAggregateResult")); }
/** * Populate the {@link AggregatingMessageHandler} with default options. * @return the current {@link IntegrationFlowDefinition}. */ public B aggregate() { return aggregate(null); }
/** * Populate the {@link AggregatingMessageHandler} with default options. * @return the current {@link IntegrationFlowDefinition}. */ public B aggregate() { return aggregate(null); }
/** * Populate the {@link AggregatingMessageHandler} with default options. * @return the current {@link IntegrationFlowDefinition}. */ public B aggregate() { return aggregate(null); }
@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")); }
@Test public void testFluxMessageChannelCleanUp() throws InterruptedException { FluxMessageChannel flux = MessageChannels.flux().get(); CountDownLatch finishLatch = new CountDownLatch(1); IntegrationFlow testFlow = f -> f .<String>split(__ -> Flux.fromStream(IntStream.range(0, 100).boxed()), null) .channel(flux) .aggregate(a -> a.releaseStrategy(m -> m.size() == 100)) .handle(__ -> finishLatch.countDown()); IntegrationFlowContext.IntegrationFlowRegistration flowRegistration = this.integrationFlowContext.registration(testFlow) .register(); flowRegistration.getInputChannel().send(new GenericMessage<>("foo")); assertTrue(finishLatch.await(10, TimeUnit.SECONDS)); assertTrue(TestUtils.getPropertyValue(flux, "publishers", Map.class).isEmpty()); flowRegistration.destroy(); }
@Bean public IntegrationFlow publishSubscribeAggregateFlow() { return flow -> flow .aggregate(a -> a.outputProcessor(g -> g.getMessages() .stream() .map(m -> (String) m.getPayload()) .collect(Collectors.joining(" ")))) .channel(c -> c.queue("subscriberAggregateResult")); }
@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")); }