/** * Populate the provided {@link AbstractMessageSplitter} to the current integration * flow position. * @param splitter the {@link AbstractMessageSplitter} to populate. * @param endpointConfigurer the {@link Consumer} to provide integration endpoint options. * @param <S> the {@link AbstractMessageSplitter} * @return the current {@link IntegrationFlowDefinition}. * @see SplitterEndpointSpec */ public <S extends AbstractMessageSplitter> B split(S splitter, Consumer<SplitterEndpointSpec<S>> endpointConfigurer) { Assert.notNull(splitter, "'splitter' must not be null"); return this.register(new SplitterEndpointSpec<>(splitter), endpointConfigurer); }
/** * Set the applySequence flag to the specified value. Defaults to {@code true}. * @param applySequence the applySequence. * @return the endpoint spec. * @see AbstractMessageSplitter#setApplySequence(boolean) */ public SplitterEndpointSpec<S> applySequence(boolean applySequence) { this.handler.setApplySequence(applySequence); return _this(); }
@Bean public IntegrationFlow flow(RabbitTemplate template, BoundRabbitChannelAdvice advice) { return IntegrationFlows.from(Gate.class) .split(s -> s.delimiters(",") .advice(advice)) .<String, String>transform(String::toUpperCase) .handle(Amqp.outboundAdapter(template).routingKey(QUEUE)) .get(); }
@Bean @SuppressWarnings("rawtypes") public IntegrationFlow splitResequenceFlow(MessageChannel executorChannel) { return f -> f.enrichHeaders(s -> s.header("FOO", "BAR")) .split("testSplitterData", "buildList", c -> c.applySequence(false)) .channel(executorChannel) .split(Message.class, Message::getPayload, c -> c.applySequence(false)) .channel(MessageChannels.executor(taskExecutor())) .split(s -> s .applySequence(false) .delimiters(",")) .channel(MessageChannels.executor(taskExecutor())) .<String, Integer>transform(Integer::parseInt) .enrichHeaders(h -> h.headerFunction(IntegrationMessageHeaderAccessor.SEQUENCE_NUMBER, Message::getPayload)) .resequence(r -> r.releasePartialSequences(true).correlationExpression("'foo'")) .headerFilter("foo", false); }
@Bean public Publisher<Message<Integer>> pollableReactiveFlow() { return IntegrationFlows .from("inputChannel") .split(s -> s.delimiters(",")) .<String, Integer>transform(Integer::parseInt) .channel(MessageChannels.queue()) .log() .toReactivePublisher(); }
@Override protected IntegrationFlowDefinition<?> buildFlow() { return from(this, "messageSource", e -> e.poller(p -> p.trigger(this::nextExecutionTime))) .split(this, null, e -> e.applySequence(false)) .transform(this) .aggregate(a -> a.processor(this, null)) .enrichHeaders(Collections.singletonMap("foo", "FOO")) .filter(this) .handle(this) .channel(MessageChannels.queue("myFlowAdapterOutput")) .log(); }
@Bean public IntegrationFlow fileSplitterFlow(BeanFactory beanFactory) { ExpressionFileListFilter<File> fileExpressionFileListFilter = new ExpressionFileListFilter<>(new FunctionExpression<File>(f -> "foo.tmp".equals(f.getName()))); fileExpressionFileListFilter.setBeanFactory(beanFactory); return IntegrationFlows .from(Files.inboundAdapter(tmpDir.getRoot()) .filter(new ChainFileListFilter<File>() .addFilter(new AcceptOnceFileListFilter<>()) .addFilter(fileExpressionFileListFilter)), e -> e.poller(p -> p.fixedDelay(100))) .split(Files.splitter() .markers() .charset(StandardCharsets.US_ASCII) .applySequence(true), e -> e.id("fileSplitter")) .channel(c -> c.queue("fileSplittingResultChannel")) .get(); }
@Bean public IntegrationFlow splitResequenceFlow() { return f -> f.enrichHeaders(s -> s.header("FOO", "BAR")) .split("testSplitterData", "buildList", c -> c.applySequence(false)) .channel(c -> c.executor(taskExecutor())) .split(Message.class, m -> m.getPayload(), c -> c.applySequence(false)) .channel(MessageChannels.executor(taskExecutor())) .split(s -> s .applySequence(false) .delimiters(",")) .channel(c -> c.executor(taskExecutor())) .<String, Integer>transform(Integer::parseInt) .enrichHeaders(h -> h.headerFunction(IntegrationMessageHeaderAccessor.SEQUENCE_NUMBER, Message::getPayload)) .resequence(r -> r.releasePartialSequences(true).correlationExpression("'foo'")) .headerFilter("foo", false); }
@Bean public Publisher<Message<Integer>> pollableReactiveFlow() { return IntegrationFlows .from("inputChannel") .split(s -> s.delimiters(",")) .<String, Integer>transform(Integer::parseInt) .channel(Channels::queue) .toReactivePublisher(); }
@Bean public IntegrationFlow jdbcSplitter() { return f -> f.<String>split(this::iterator, e -> e.applySequence(false)) .channel(c -> c.queue("splitResultsChannel")); }
@Bean public IntegrationFlow fileSplitterFlow() { return IntegrationFlows .from(s -> s.file(tmpDir.getRoot()) .patternFilter("foo.tmp"), e -> e.poller(p -> p.fixedDelay(100))) .split(Files.splitter() .markers() .charset(StandardCharsets.US_ASCII) .applySequence(true), e -> e.id("fileSplitter")) .channel(c -> c.queue("fileSplittingResultChannel")) .get(); }
/** * Set the applySequence flag to the specified value. Defaults to {@code true}. * @param applySequence the applySequence. * @return the endpoint spec. * @see AbstractMessageSplitter#setApplySequence(boolean) */ public SplitterEndpointSpec<S> applySequence(boolean applySequence) { this.handler.setApplySequence(applySequence); return _this(); }
/** * Populate the provided {@link AbstractMessageSplitter} to the current integration * flow position. * @param splitter the {@link AbstractMessageSplitter} to populate. * @param endpointConfigurer the {@link Consumer} to provide integration endpoint options. * @param <S> the {@link AbstractMessageSplitter} * @return the current {@link IntegrationFlowDefinition}. * @see SplitterEndpointSpec */ public <S extends AbstractMessageSplitter> B split(S splitter, Consumer<SplitterEndpointSpec<S>> endpointConfigurer) { Assert.notNull(splitter, "'splitter' must not be null"); return this.register(new SplitterEndpointSpec<>(splitter), endpointConfigurer); }
@Bean public IntegrationFlow flow(RabbitTemplate template) { return IntegrationFlows.from(Gate.class) .split(s -> s.delimiters(",") .advice(new BoundRabbitChannelAdvice(template, Duration.ofSeconds(10)))) .<String, String>transform(String::toUpperCase) .handle(Amqp.outboundAdapter(template).routingKey("rk")) .get(); }
@Override protected IntegrationFlowDefinition<?> buildFlow() { return from(this, "messageSource", e -> e.poller(p -> p.trigger(this::nextExecutionTime))) .split(this, null, e -> e.applySequence(false)) .transform(this) .aggregate(a -> a.processor(this, null)) .enrichHeaders(Collections.singletonMap("foo", "FOO")) .filter(this) .handle(this) .channel(c -> c.queue("myFlowAdapterOutput")); }
/** * Set the applySequence flag to the specified value. Defaults to {@code true}. * @param applySequence the applySequence. * @return the endpoint spec. * @see AbstractMessageSplitter#setApplySequence(boolean) */ public SplitterEndpointSpec<S> applySequence(boolean applySequence) { this.handler.setApplySequence(applySequence); return _this(); }
/** * Populate the provided {@link AbstractMessageSplitter} to the current integration * flow position. * @param splitter the {@link AbstractMessageSplitter} to populate. * @param endpointConfigurer the {@link Consumer} to provide integration endpoint options. * @param <S> the {@link AbstractMessageSplitter} * @return the current {@link IntegrationFlowDefinition}. * @see SplitterEndpointSpec */ public <S extends AbstractMessageSplitter> B split(S splitter, Consumer<SplitterEndpointSpec<S>> endpointConfigurer) { Assert.notNull(splitter, "'splitter' must not be null"); return this.register(new SplitterEndpointSpec<S>(splitter), endpointConfigurer); }
/** * Set the applySequence flag to the specified value. Defaults to {@code true}. * @param applySequence the applySequence. * @return the endpoint spec. * @see AbstractMessageSplitter#setApplySequence(boolean) */ public SplitterEndpointSpec<S> applySequence(boolean applySequence) { this.handler.setApplySequence(applySequence); return _this(); }
/** * Populate the provided {@link AbstractMessageSplitter} to the current integration * flow position. * @param splitter the {@link AbstractMessageSplitter} to populate. * @param endpointConfigurer the {@link Consumer} to provide integration endpoint options. * @param <S> the {@link AbstractMessageSplitter} * @return the current {@link IntegrationFlowDefinition}. * @see SplitterEndpointSpec */ public <S extends AbstractMessageSplitter> B split(S splitter, Consumer<SplitterEndpointSpec<S>> endpointConfigurer) { Assert.notNull(splitter, "'splitter' must not be null"); return this.register(new SplitterEndpointSpec<S>(splitter), endpointConfigurer); }