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 IntegrationFlows
.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
- See Also:
IntegrationFlowBuilder,StandardIntegrationFlow,IntegrationFlowAdapter
-
Method Summary
Modifier and Type Method Description voidconfigure(IntegrationFlowDefinition<?> flow)The callback-based function to declare the chain of EIP-methods to configure an integration flow with the providedIntegrationFlowDefinition.default MessageChannelgetInputChannel()Return the firstMessageChannelcomponent which is essentially a flow input channel.default Map<Object,String>getIntegrationComponents()Return a map of integration components managed by this flow (if any).
-
Method Details
-
configure
The callback-based function to declare the chain of EIP-methods to configure an integration flow with the providedIntegrationFlowDefinition.- Parameters:
flow- theIntegrationFlowDefinitionto configure
-
getInputChannel
Return the firstMessageChannelcomponent which is essentially a flow input channel.- Returns:
- the channel.
- Since:
- 5.0.4
-
getIntegrationComponents
Return a map of integration components managed by this flow (if any).- Returns:
- the map of integration components managed by this flow.
- Since:
- 5.5.4
-