Interface IntegrationFlow

All Known Implementing Classes:
IntegrationFlowAdapter, StandardIntegrationFlow
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface IntegrationFlow
The main Integration DSL abstraction.

The StandardIntegrationFlow implementation (produced by IntegrationFlowBuilder) represents a container for the integration components, which will be registered in the application context. Typically, is used as a @Bean definition:

 @Bean
 public IntegrationFlow fileReadingFlow() {
     return IntegrationFlow
            .from(Files.inboundAdapter(tmpDir.getRoot()), e -> e.poller(Pollers.fixedDelay(100)))
            .transform(Files.fileToString())
            .channel(MessageChannels.queue("fileReadingResultChannel"))
            .get();
 }

Can be used as a Lambda for top level definition as well as sub-flow definitions:

@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"));
}

Also, this interface can be implemented directly to encapsulate the integration logic in the target service:

 @Component
 public class MyFlow implements IntegrationFlow {

       @Override
       public void configure(IntegrationFlowDefinition<?> f) {
               f.<String, String>transform(String::toUpperCase);
       }

 }
Since:
5.0
Author:
Artem Bilan, Gary Russell, Oleg Zhurakousky, Artem Vozhdayenko, Glenn Renfro
See Also: