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 SummaryModifier and TypeMethodDescriptionvoidconfigure(IntegrationFlowDefinition<?> flow) The callback-based function to declare the chain of EIP-methods to configure an integration flow with the providedIntegrationFlowDefinition.static <T> @Nullable TextractProxyTarget(@Nullable T target) static IntegrationFlowBuilderPopulate theMessageChannelto the newIntegrationFlowBuilderchain, which becomes as arequestChannelfor the Messaging Gateway(s) built on the provided service interface.static IntegrationFlowBuilderfrom(Class<?> serviceInterface, @Nullable 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, @Nullable 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, @Nullable 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, @Nullable Consumer<SourcePollingChannelAdapterSpec> endpointConfigurer) ProvidesSupplieras source of messages to the integration flow.default @Nullable MessageChannelReturn the firstMessageChannelcomponent which is essentially a flow input channel.Return a map of integration components managed by this flow (if any).
- 
Method Details- 
configureThe callback-based function to declare the chain of EIP-methods to configure an integration flow with the providedIntegrationFlowDefinition.- Parameters:
- flow- the- IntegrationFlowDefinitionto configure
 
- 
getInputChannelReturn the firstMessageChannelcomponent which is essentially a flow input channel.- Returns:
- the channel.
- Since:
- 5.0.4
 
- 
getIntegrationComponents
- 
fromPopulate theMessageChannelname to the newIntegrationFlowBuilderchain. TheIntegrationFlowinputChannel.- Parameters:
- messageChannelName- the name of existing- MessageChannelbean. The new- DirectChannelbean will be created on context startup if there is no bean with this name.
- Returns:
- new IntegrationFlowBuilder.
- Since:
- 6.0
 
- 
fromPopulate theMessageChannelobject to theIntegrationFlowBuilderchain using the fluent API fromMessageChannelSpec. TheIntegrationFlowinputChannel.- Parameters:
- messageChannelSpec- the MessageChannelSpec to populate- MessageChannelinstance.
- Returns:
- new IntegrationFlowBuilder.
- Since:
- 6.0
- See Also:
 
- 
fromPopulate theMessageChannelname to the newIntegrationFlowBuilderchain. Typically, for theFixedSubscriberChanneltogether withfixedSubscriber = true. TheIntegrationFlowinputChannel.- Parameters:
- messageChannelName- the name for- DirectChannelor- FixedSubscriberChannelto be created on context startup, not reference. The- MessageChanneldepends on the- fixedSubscriberboolean argument.
- fixedSubscriber- the boolean flag to determine if result- MessageChannelshould be- DirectChannel, if- falseor- FixedSubscriberChannel, if- true.
- Returns:
- new IntegrationFlowBuilder.
- Since:
- 6.0
- See Also:
 
- 
fromPopulate the providedMessageChannelobject to theIntegrationFlowBuilderchain. TheIntegrationFlowinputChannel.- Parameters:
- messageChannel- the- MessageChannelto populate.
- Returns:
- new IntegrationFlowBuilder.
- Since:
- 6.0
 
- 
fromstatic IntegrationFlowBuilder from(MessageSourceSpec<?, ? extends MessageSource<?>> messageSourceSpec) Populate theMessageSourceobject to theIntegrationFlowBuilderchain using the fluent API from the providedMessageSourceSpec. TheIntegrationFlowstartMessageSource.- Parameters:
- messageSourceSpec- the- MessageSourceSpecto use.
- Returns:
- new IntegrationFlowBuilder.
- Since:
- 6.0
- See Also:
 
- 
fromstatic IntegrationFlowBuilder from(MessageSourceSpec<?, ? extends MessageSource<?>> messageSourceSpec, @Nullable Consumer<SourcePollingChannelAdapterSpec> endpointConfigurer) Populate theMessageSourceobject to theIntegrationFlowBuilderchain using the fluent API from the providedMessageSourceSpec. TheIntegrationFlowstartMessageSource.- Parameters:
- messageSourceSpec- the- MessageSourceSpecto use.
- endpointConfigurer- the- Consumerto provide more options for the- SourcePollingChannelAdapterFactoryBean.
- Returns:
- new IntegrationFlowBuilder.
- Since:
- 6.0
- See Also:
 
- 
fromSupplierProvidesSupplieras 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- the- Supplierto populate.
- Returns:
- new IntegrationFlowBuilder.
- Since:
- 6.0
- See Also:
 
- 
fromSupplierstatic <T> IntegrationFlowBuilder fromSupplier(Supplier<T> messageSource, @Nullable 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- the- Supplierto populate.
- endpointConfigurer- the- Consumerto provide more options for the- SourcePollingChannelAdapterFactoryBean.
- Returns:
- new IntegrationFlowBuilder.
- Since:
- 6.0
- See Also:
 
- 
fromPopulate the providedMessageSourceobject to theIntegrationFlowBuilderchain. TheIntegrationFlowstartMessageSource.- Parameters:
- messageSource- the- MessageSourceto populate.
- Returns:
- new IntegrationFlowBuilder.
- Since:
- 6.0
- See Also:
 
- 
fromstatic IntegrationFlowBuilder from(MessageSource<?> messageSource, @Nullable Consumer<SourcePollingChannelAdapterSpec> endpointConfigurer) Populate the providedMessageSourceobject to theIntegrationFlowBuilderchain. TheIntegrationFlowstartMessageSource. In addition, useSourcePollingChannelAdapterSpecto provide options for the underlyingSourcePollingChannelAdapterendpoint.- Parameters:
- messageSource- the- MessageSourceto populate.
- endpointConfigurer- the- Consumerto provide more options for the- SourcePollingChannelAdapterFactoryBean.
- Returns:
- new IntegrationFlowBuilder.
- Since:
- 6.0
- See Also:
 
- 
fromPopulate theMessageProducerSupportobject to theIntegrationFlowBuilderchain using the fluent API from theMessageProducerSpec. TheIntegrationFlowstartMessageProducer.- Parameters:
- messageProducerSpec- the- MessageProducerSpecto use.
- Returns:
- new IntegrationFlowBuilder.
- Since:
- 6.0
- See Also:
 
- 
fromPopulate the providedMessageProducerSupportobject to theIntegrationFlowBuilderchain. TheIntegrationFlowstartMessageProducer.- Parameters:
- messageProducer- the- MessageProducerSupportto populate.
- Returns:
- new IntegrationFlowBuilder.
- Since:
- 6.0
 
- 
fromPopulate theMessagingGatewaySupportobject to theIntegrationFlowBuilderchain using the fluent API from theMessagingGatewaySpec. TheIntegrationFlowstartMessagingGateway.- Parameters:
- inboundGatewaySpec- the- MessagingGatewaySpecto use.
- Returns:
- new IntegrationFlowBuilder.
- Since:
- 6.0
 
- 
fromPopulate the providedMessagingGatewaySupportobject to theIntegrationFlowBuilderchain. TheIntegrationFlowstartMessageProducer.- Parameters:
- inboundGateway- the- MessagingGatewaySupportto populate.
- Returns:
- new IntegrationFlowBuilder.
- Since:
- 6.0
 
- 
fromPopulate 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 optional- MessagingGatewayannotation.
- Returns:
- new IntegrationFlowBuilder.
- Since:
- 6.0
 
- 
fromstatic 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 optional- MessagingGatewayannotation.
- endpointConfigurer- the- Consumerto configure proxy bean for gateway.
- Returns:
- new IntegrationFlowBuilder.
- Since:
- 6.0
 
- 
fromPopulate aFluxMessageChannelto theIntegrationFlowBuilderchain and subscribe it to the providedPublisher.- Parameters:
- publisher- the- Publisherto subscribe to.
- Returns:
- new IntegrationFlowBuilder.
- Since:
- 6.0
 
- 
fromStart the flow with a composition from theIntegrationFlow.- Parameters:
- other- the- IntegrationFlowfrom which to compose.
- Returns:
- new IntegrationFlowBuilder.
- Since:
- 6.0
 
- 
extractProxyTargetstatic <T> @Nullable T extractProxyTarget(@Nullable T target) 
 
-