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 TypeMethodDescriptionvoid
configure
(IntegrationFlowDefinition<?> flow) The callback-based function to declare the chain of EIP-methods to configure an integration flow with the providedIntegrationFlowDefinition
.static IntegrationFlowBuilder
Populate theMessageChannel
to the newIntegrationFlowBuilder
chain, which becomes as arequestChannel
for the Messaging Gateway(s) built on the provided service interface.static IntegrationFlowBuilder
from
(Class<?> serviceInterface, Consumer<GatewayProxySpec> endpointConfigurer) Populate theMessageChannel
to the newIntegrationFlowBuilder
chain, which becomes as arequestChannel
for the Messaging Gateway(s) built on the provided service interface.static IntegrationFlowBuilder
Populate theMessageChannel
name to the newIntegrationFlowBuilder
chain.static IntegrationFlowBuilder
Populate theMessageChannel
name to the newIntegrationFlowBuilder
chain.static IntegrationFlowBuilder
Populate aFluxMessageChannel
to theIntegrationFlowBuilder
chain and subscribe it to the providedPublisher
.static IntegrationFlowBuilder
from
(MessageSource<?> messageSource) Populate the providedMessageSource
object to theIntegrationFlowBuilder
chain.static IntegrationFlowBuilder
from
(MessageSource<?> messageSource, Consumer<SourcePollingChannelAdapterSpec> endpointConfigurer) Populate the providedMessageSource
object to theIntegrationFlowBuilder
chain.static IntegrationFlowBuilder
from
(IntegrationFlow other) Start the flow with a composition from theIntegrationFlow
.static IntegrationFlowBuilder
from
(MessageChannelSpec<?, ?> messageChannelSpec) Populate theMessageChannel
object to theIntegrationFlowBuilder
chain using the fluent API fromMessageChannelSpec
.static IntegrationFlowBuilder
from
(MessageProducerSpec<?, ?> messageProducerSpec) Populate theMessageProducerSupport
object to theIntegrationFlowBuilder
chain using the fluent API from theMessageProducerSpec
.static IntegrationFlowBuilder
from
(MessageSourceSpec<?, ? extends MessageSource<?>> messageSourceSpec) Populate theMessageSource
object to theIntegrationFlowBuilder
chain using the fluent API from the providedMessageSourceSpec
.static IntegrationFlowBuilder
from
(MessageSourceSpec<?, ? extends MessageSource<?>> messageSourceSpec, Consumer<SourcePollingChannelAdapterSpec> endpointConfigurer) Populate theMessageSource
object to theIntegrationFlowBuilder
chain using the fluent API from the providedMessageSourceSpec
.static IntegrationFlowBuilder
from
(MessagingGatewaySpec<?, ?> inboundGatewaySpec) Populate theMessagingGatewaySupport
object to theIntegrationFlowBuilder
chain using the fluent API from theMessagingGatewaySpec
.static IntegrationFlowBuilder
from
(MessageProducerSupport messageProducer) Populate the providedMessageProducerSupport
object to theIntegrationFlowBuilder
chain.static IntegrationFlowBuilder
from
(MessagingGatewaySupport inboundGateway) Populate the providedMessagingGatewaySupport
object to theIntegrationFlowBuilder
chain.static IntegrationFlowBuilder
from
(MessageChannel messageChannel) Populate the providedMessageChannel
object to theIntegrationFlowBuilder
chain.static <T> IntegrationFlowBuilder
fromSupplier
(Supplier<T> messageSource) ProvidesSupplier
as source of messages to the integration flow which will be triggered by the application context's default poller (which must be declared).static <T> IntegrationFlowBuilder
fromSupplier
(Supplier<T> messageSource, Consumer<SourcePollingChannelAdapterSpec> endpointConfigurer) ProvidesSupplier
as source of messages to the integration flow.default MessageChannel
Return the firstMessageChannel
component 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
- theIntegrationFlowDefinition
to configure
-
getInputChannel
Return the firstMessageChannel
component 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 theMessageChannel
name to the newIntegrationFlowBuilder
chain. TheIntegrationFlow
inputChannel
.- Parameters:
messageChannelName
- the name of existingMessageChannel
bean. The newDirectChannel
bean will be created on context startup if there is no bean with this name.- Returns:
- new
IntegrationFlowBuilder
. - Since:
- 6.0
-
from
Populate theMessageChannel
object to theIntegrationFlowBuilder
chain using the fluent API fromMessageChannelSpec
. TheIntegrationFlow
inputChannel
.- Parameters:
messageChannelSpec
- the MessageChannelSpec to populateMessageChannel
instance.- Returns:
- new
IntegrationFlowBuilder
. - Since:
- 6.0
- See Also:
-
from
Populate theMessageChannel
name to the newIntegrationFlowBuilder
chain. Typically, for theFixedSubscriberChannel
together withfixedSubscriber = true
. TheIntegrationFlow
inputChannel
.- Parameters:
messageChannelName
- the name forDirectChannel
orFixedSubscriberChannel
to be created on context startup, not reference. TheMessageChannel
depends on thefixedSubscriber
boolean argument.fixedSubscriber
- the boolean flag to determine if resultMessageChannel
should beDirectChannel
, iffalse
orFixedSubscriberChannel
, iftrue
.- Returns:
- new
IntegrationFlowBuilder
. - Since:
- 6.0
- See Also:
-
from
Populate the providedMessageChannel
object to theIntegrationFlowBuilder
chain. TheIntegrationFlow
inputChannel
.- Parameters:
messageChannel
- theMessageChannel
to populate.- Returns:
- new
IntegrationFlowBuilder
. - Since:
- 6.0
-
from
static IntegrationFlowBuilder from(MessageSourceSpec<?, ? extends MessageSource<?>> messageSourceSpec) Populate theMessageSource
object to theIntegrationFlowBuilder
chain using the fluent API from the providedMessageSourceSpec
. TheIntegrationFlow
startMessageSource
.- Parameters:
messageSourceSpec
- theMessageSourceSpec
to use.- Returns:
- new
IntegrationFlowBuilder
. - Since:
- 6.0
- See Also:
-
from
static IntegrationFlowBuilder from(MessageSourceSpec<?, ? extends MessageSource<?>> messageSourceSpec, @Nullable Consumer<SourcePollingChannelAdapterSpec> endpointConfigurer) Populate theMessageSource
object to theIntegrationFlowBuilder
chain using the fluent API from the providedMessageSourceSpec
. TheIntegrationFlow
startMessageSource
.- Parameters:
messageSourceSpec
- theMessageSourceSpec
to use.endpointConfigurer
- theConsumer
to provide more options for theSourcePollingChannelAdapterFactoryBean
.- Returns:
- new
IntegrationFlowBuilder
. - Since:
- 6.0
- See Also:
-
fromSupplier
ProvidesSupplier
as 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
- theSupplier
to populate.- Returns:
- new
IntegrationFlowBuilder
. - Since:
- 6.0
- See Also:
-
fromSupplier
static <T> IntegrationFlowBuilder fromSupplier(Supplier<T> messageSource, @Nullable Consumer<SourcePollingChannelAdapterSpec> endpointConfigurer) ProvidesSupplier
as source of messages to the integration flow. which will be triggered by a providedSourcePollingChannelAdapter
.- Type Parameters:
T
- the supplier type.- Parameters:
messageSource
- theSupplier
to populate.endpointConfigurer
- theConsumer
to provide more options for theSourcePollingChannelAdapterFactoryBean
.- Returns:
- new
IntegrationFlowBuilder
. - Since:
- 6.0
- See Also:
-
from
Populate the providedMessageSource
object to theIntegrationFlowBuilder
chain. TheIntegrationFlow
startMessageSource
.- Parameters:
messageSource
- theMessageSource
to populate.- Returns:
- new
IntegrationFlowBuilder
. - Since:
- 6.0
- See Also:
-
from
static IntegrationFlowBuilder from(MessageSource<?> messageSource, @Nullable Consumer<SourcePollingChannelAdapterSpec> endpointConfigurer) Populate the providedMessageSource
object to theIntegrationFlowBuilder
chain. TheIntegrationFlow
startMessageSource
. In addition useSourcePollingChannelAdapterSpec
to provide options for the underlyingSourcePollingChannelAdapter
endpoint.- Parameters:
messageSource
- theMessageSource
to populate.endpointConfigurer
- theConsumer
to provide more options for theSourcePollingChannelAdapterFactoryBean
.- Returns:
- new
IntegrationFlowBuilder
. - Since:
- 6.0
- See Also:
-
from
Populate theMessageProducerSupport
object to theIntegrationFlowBuilder
chain using the fluent API from theMessageProducerSpec
. TheIntegrationFlow
startMessageProducer
.- Parameters:
messageProducerSpec
- theMessageProducerSpec
to use.- Returns:
- new
IntegrationFlowBuilder
. - Since:
- 6.0
- See Also:
-
from
Populate the providedMessageProducerSupport
object to theIntegrationFlowBuilder
chain. TheIntegrationFlow
startMessageProducer
.- Parameters:
messageProducer
- theMessageProducerSupport
to populate.- Returns:
- new
IntegrationFlowBuilder
. - Since:
- 6.0
-
from
Populate theMessagingGatewaySupport
object to theIntegrationFlowBuilder
chain using the fluent API from theMessagingGatewaySpec
. TheIntegrationFlow
startMessagingGateway
.- Parameters:
inboundGatewaySpec
- theMessagingGatewaySpec
to use.- Returns:
- new
IntegrationFlowBuilder
. - Since:
- 6.0
-
from
Populate the providedMessagingGatewaySupport
object to theIntegrationFlowBuilder
chain. TheIntegrationFlow
startMessageProducer
.- Parameters:
inboundGateway
- theMessagingGatewaySupport
to populate.- Returns:
- new
IntegrationFlowBuilder
. - Since:
- 6.0
-
from
Populate theMessageChannel
to the newIntegrationFlowBuilder
chain, which becomes as arequestChannel
for 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 theIntegrationFlow
bean name plus.gateway
suffix.- Parameters:
serviceInterface
- the service interface class with an optionalMessagingGateway
annotation.- Returns:
- new
IntegrationFlowBuilder
. - Since:
- 6.0
-
from
static IntegrationFlowBuilder from(Class<?> serviceInterface, @Nullable Consumer<GatewayProxySpec> endpointConfigurer) Populate theMessageChannel
to the newIntegrationFlowBuilder
chain, which becomes as arequestChannel
for 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 optionalMessagingGateway
annotation.endpointConfigurer
- theConsumer
to configure proxy bean for gateway.- Returns:
- new
IntegrationFlowBuilder
. - Since:
- 6.0
-
from
Populate aFluxMessageChannel
to theIntegrationFlowBuilder
chain and subscribe it to the providedPublisher
.- Parameters:
publisher
- thePublisher
to subscribe to.- Returns:
- new
IntegrationFlowBuilder
. - Since:
- 6.0
-
from
Start the flow with a composition from theIntegrationFlow
.- Parameters:
other
- theIntegrationFlow
from which to compose.- Returns:
- new
IntegrationFlowBuilder
. - Since:
- 6.0
-