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.
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
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoidconfigure(IntegrationFlowDefinition<?> flow) The callback-based function to declare the chain of EIP-methods to configure an integration flow with the providedIntegrationFlowDefinition.static IntegrationFlowBuilderPopulate theMessageChannelto the newIntegrationFlowBuilderchain, which becomes as arequestChannelfor the Messaging Gateway(s) built on the provided service interface.static IntegrationFlowBuilderfrom(Class<?> serviceInterface, Consumer<GatewayProxySpec> endpointConfigurer) Populate theMessageChannelto the newIntegrationFlowBuilderchain, which becomes as arequestChannelfor the Messaging Gateway(s) built on the provided service interface.static IntegrationFlowBuilderPopulate theMessageChannelname to the newIntegrationFlowBuilderchain.static IntegrationFlowBuilderPopulate theMessageChannelname to the newIntegrationFlowBuilderchain.static IntegrationFlowBuilderPopulate aFluxMessageChannelto theIntegrationFlowBuilderchain and subscribe it to the providedPublisher.static IntegrationFlowBuilderfrom(MessageSource<?> messageSource) Populate the providedMessageSourceobject to theIntegrationFlowBuilderchain.static IntegrationFlowBuilderfrom(MessageSource<?> messageSource, Consumer<SourcePollingChannelAdapterSpec> endpointConfigurer) Populate the providedMessageSourceobject to theIntegrationFlowBuilderchain.static IntegrationFlowBuilderfrom(IntegrationFlow other) Start the flow with a composition from theIntegrationFlow.static IntegrationFlowBuilderfrom(MessageChannelSpec<?, ?> messageChannelSpec) Populate theMessageChannelobject to theIntegrationFlowBuilderchain using the fluent API fromMessageChannelSpec.static IntegrationFlowBuilderfrom(MessageProducerSpec<?, ?> messageProducerSpec) Populate theMessageProducerSupportobject to theIntegrationFlowBuilderchain using the fluent API from theMessageProducerSpec.static IntegrationFlowBuilderfrom(MessageSourceSpec<?, ? extends MessageSource<?>> messageSourceSpec) Populate theMessageSourceobject to theIntegrationFlowBuilderchain using the fluent API from the providedMessageSourceSpec.static IntegrationFlowBuilderfrom(MessageSourceSpec<?, ? extends MessageSource<?>> messageSourceSpec, Consumer<SourcePollingChannelAdapterSpec> endpointConfigurer) Populate theMessageSourceobject to theIntegrationFlowBuilderchain using the fluent API from the providedMessageSourceSpec.static IntegrationFlowBuilderfrom(MessagingGatewaySpec<?, ?> inboundGatewaySpec) Populate theMessagingGatewaySupportobject to theIntegrationFlowBuilderchain using the fluent API from theMessagingGatewaySpec.static IntegrationFlowBuilderfrom(MessageProducerSupport messageProducer) Populate the providedMessageProducerSupportobject to theIntegrationFlowBuilderchain.static IntegrationFlowBuilderfrom(MessagingGatewaySupport inboundGateway) Populate the providedMessagingGatewaySupportobject to theIntegrationFlowBuilderchain.static IntegrationFlowBuilderfrom(MessageChannel messageChannel) Populate the providedMessageChannelobject to theIntegrationFlowBuilderchain.static <T> IntegrationFlowBuilderfromSupplier(Supplier<T> messageSource) ProvidesSupplieras source of messages to the integration flow which will be triggered by the application context's default poller (which must be declared).static <T> IntegrationFlowBuilderfromSupplier(Supplier<T> messageSource, Consumer<SourcePollingChannelAdapterSpec> endpointConfigurer) ProvidesSupplieras source of messages to the integration flow.default MessageChannelReturn the firstMessageChannelcomponent which is essentially a flow input channel.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
-
from
Populate theMessageChannelname to the newIntegrationFlowBuilderchain. TheIntegrationFlowinputChannel.- Parameters:
messageChannelName- the name of existingMessageChannelbean. The newDirectChannelbean will be created on context startup if there is no bean with this name.- Returns:
- new
IntegrationFlowBuilder. - Since:
- 6.0
-
from
Populate theMessageChannelobject to theIntegrationFlowBuilderchain using the fluent API fromMessageChannelSpec. TheIntegrationFlowinputChannel.- Parameters:
messageChannelSpec- the MessageChannelSpec to populateMessageChannelinstance.- Returns:
- new
IntegrationFlowBuilder. - Since:
- 6.0
- See Also:
-
from
Populate theMessageChannelname to the newIntegrationFlowBuilderchain. Typically, for theFixedSubscriberChanneltogether withfixedSubscriber = true. TheIntegrationFlowinputChannel.- Parameters:
messageChannelName- the name forDirectChannelorFixedSubscriberChannelto be created on context startup, not reference. TheMessageChanneldepends on thefixedSubscriberboolean argument.fixedSubscriber- the boolean flag to determine if resultMessageChannelshould beDirectChannel, iffalseorFixedSubscriberChannel, iftrue.- Returns:
- new
IntegrationFlowBuilder. - Since:
- 6.0
- See Also:
-
from
Populate the providedMessageChannelobject to theIntegrationFlowBuilderchain. TheIntegrationFlowinputChannel.- Parameters:
messageChannel- theMessageChannelto populate.- Returns:
- new
IntegrationFlowBuilder. - Since:
- 6.0
-
from
static IntegrationFlowBuilder from(MessageSourceSpec<?, ? extends MessageSource<?>> messageSourceSpec) Populate theMessageSourceobject to theIntegrationFlowBuilderchain using the fluent API from the providedMessageSourceSpec. TheIntegrationFlowstartMessageSource.- Parameters:
messageSourceSpec- theMessageSourceSpecto use.- Returns:
- new
IntegrationFlowBuilder. - Since:
- 6.0
- See Also:
-
from
static IntegrationFlowBuilder from(MessageSourceSpec<?, ? extends MessageSource<?>> messageSourceSpec, Consumer<SourcePollingChannelAdapterSpec> endpointConfigurer) Populate theMessageSourceobject to theIntegrationFlowBuilderchain using the fluent API from the providedMessageSourceSpec. TheIntegrationFlowstartMessageSource.- Parameters:
messageSourceSpec- theMessageSourceSpecto use.endpointConfigurer- theConsumerto provide more options for theSourcePollingChannelAdapterFactoryBean.- Returns:
- new
IntegrationFlowBuilder. - Since:
- 6.0
- See Also:
-
fromSupplier
ProvidesSupplieras source of messages to the integration flow which will be triggered by the application context's default poller (which must be declared).- Type Parameters:
T- the supplier type.- Parameters:
messageSource- theSupplierto populate.- Returns:
- new
IntegrationFlowBuilder. - Since:
- 6.0
- See Also:
-
fromSupplier
static <T> IntegrationFlowBuilder fromSupplier(Supplier<T> messageSource, Consumer<SourcePollingChannelAdapterSpec> endpointConfigurer) ProvidesSupplieras source of messages to the integration flow. which will be triggered by a providedSourcePollingChannelAdapter.- Type Parameters:
T- the supplier type.- Parameters:
messageSource- theSupplierto populate.endpointConfigurer- theConsumerto provide more options for theSourcePollingChannelAdapterFactoryBean.- Returns:
- new
IntegrationFlowBuilder. - Since:
- 6.0
- See Also:
-
from
Populate the providedMessageSourceobject to theIntegrationFlowBuilderchain. TheIntegrationFlowstartMessageSource.- Parameters:
messageSource- theMessageSourceto populate.- Returns:
- new
IntegrationFlowBuilder. - Since:
- 6.0
- See Also:
-
from
static IntegrationFlowBuilder from(MessageSource<?> messageSource, @Nullable Consumer<SourcePollingChannelAdapterSpec> endpointConfigurer) Populate the providedMessageSourceobject to theIntegrationFlowBuilderchain. TheIntegrationFlowstartMessageSource. In addition useSourcePollingChannelAdapterSpecto provide options for the underlyingSourcePollingChannelAdapterendpoint.- Parameters:
messageSource- theMessageSourceto populate.endpointConfigurer- theConsumerto provide more options for theSourcePollingChannelAdapterFactoryBean.- Returns:
- new
IntegrationFlowBuilder. - Since:
- 6.0
- See Also:
-
from
Populate theMessageProducerSupportobject to theIntegrationFlowBuilderchain using the fluent API from theMessageProducerSpec. TheIntegrationFlowstartMessageProducer.- Parameters:
messageProducerSpec- theMessageProducerSpecto use.- Returns:
- new
IntegrationFlowBuilder. - Since:
- 6.0
- See Also:
-
from
Populate the providedMessageProducerSupportobject to theIntegrationFlowBuilderchain. TheIntegrationFlowstartMessageProducer.- Parameters:
messageProducer- theMessageProducerSupportto populate.- Returns:
- new
IntegrationFlowBuilder. - Since:
- 6.0
-
from
Populate theMessagingGatewaySupportobject to theIntegrationFlowBuilderchain using the fluent API from theMessagingGatewaySpec. TheIntegrationFlowstartMessagingGateway.- Parameters:
inboundGatewaySpec- theMessagingGatewaySpecto use.- Returns:
- new
IntegrationFlowBuilder. - Since:
- 6.0
-
from
Populate the providedMessagingGatewaySupportobject to theIntegrationFlowBuilderchain. TheIntegrationFlowstartMessageProducer.- Parameters:
inboundGateway- theMessagingGatewaySupportto populate.- Returns:
- new
IntegrationFlowBuilder. - Since:
- 6.0
-
from
Populate theMessageChannelto the newIntegrationFlowBuilderchain, which becomes as arequestChannelfor the Messaging Gateway(s) built on the provided service interface.A gateway proxy bean for provided service interface is registered under a name from the
MessagingGateway.name()if present or from theIntegrationFlowbean name plus.gatewaysuffix.- Parameters:
serviceInterface- the service interface class with an optionalMessagingGatewayannotation.- Returns:
- new
IntegrationFlowBuilder. - Since:
- 6.0
-
from
static IntegrationFlowBuilder from(Class<?> serviceInterface, @Nullable Consumer<GatewayProxySpec> endpointConfigurer) Populate theMessageChannelto the newIntegrationFlowBuilderchain, which becomes as arequestChannelfor the Messaging Gateway(s) built on the provided service interface.A gateway proxy bean for provided service interface is based on the options configured via provided
Consumer.- Parameters:
serviceInterface- the service interface class with an optionalMessagingGatewayannotation.endpointConfigurer- theConsumerto configure proxy bean for gateway.- Returns:
- new
IntegrationFlowBuilder. - Since:
- 6.0
-
from
Populate aFluxMessageChannelto theIntegrationFlowBuilderchain and subscribe it to the providedPublisher.- Parameters:
publisher- thePublisherto subscribe to.- Returns:
- new
IntegrationFlowBuilder. - Since:
- 6.0
-
from
Start the flow with a composition from theIntegrationFlow.- Parameters:
other- theIntegrationFlowfrom which to compose.- Returns:
- new
IntegrationFlowBuilder. - Since:
- 6.0
-