@FunctionalInterface public interface IntegrationFlow
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);
}
}
IntegrationFlowBuilder,
StandardIntegrationFlow,
IntegrationFlowAdapter| Modifier and Type | Method and Description |
|---|---|
void |
configure(IntegrationFlowDefinition<?> flow)
The callback-based function to declare the chain of EIP-methods to
configure an integration flow with the provided
IntegrationFlowDefinition. |
default MessageChannel |
getInputChannel()
Return the first
MessageChannel component
which is essential a flow input channel. |
void configure(IntegrationFlowDefinition<?> flow)
IntegrationFlowDefinition.flow - the IntegrationFlowDefinition to configuredefault MessageChannel getInputChannel()
MessageChannel component
which is essential a flow input channel.