Class StandardIntegrationFlow

java.lang.Object
org.springframework.integration.dsl.StandardIntegrationFlow
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanNameAware, org.springframework.context.Lifecycle, org.springframework.context.Phased, org.springframework.context.SmartLifecycle, IntegrationFlow, NamedComponent

public class StandardIntegrationFlow extends Object implements IntegrationFlow, org.springframework.context.SmartLifecycle, org.springframework.beans.factory.BeanNameAware, NamedComponent
The standard implementation of the IntegrationFlow interface instantiated by the Framework. Represents a logical container for the components configured for the integration flow. It can be treated as a single component, especially when declaring dynamically, using the IntegrationFlowContext.

Being the logical container for the target integration components, this class controls the lifecycle of all those components, when its start() and stop() are invoked.

This component is never autoStartup, because all the components are registered as beans in the application context and their initial start up phase is controlled from the lifecycle processor automatically.

However, when we register an IntegrationFlow dynamically using the IntegrationFlowContext API, the lifecycle processor from the application context is not involved; therefore we should control the lifecycle of the beans manually, or rely on the IntegrationFlowContext API. Its created registration is autoStartup by default and starts the flow when it is registered. If you disable the registration's auto- startup behavior, you are responsible for starting the flow or its component beans.

This component doesn't track its running state during stop() action and delegates directly to stop the registered components, to avoid dangling processes after a registered IntegrationFlow is removed from the flow context.

Since:
5.0
See Also:
  • Method Details

    • setBeanName

      public void setBeanName(String name)
      Specified by:
      setBeanName in interface org.springframework.beans.factory.BeanNameAware
    • getComponentName

      public String getComponentName()
      Specified by:
      getComponentName in interface NamedComponent
    • getComponentType

      public String getComponentType()
      Specified by:
      getComponentType in interface NamedComponent
    • configure

      public void configure(IntegrationFlowDefinition<?> flow)
      Description copied from interface: IntegrationFlow
      The callback-based function to declare the chain of EIP-methods to configure an integration flow with the provided IntegrationFlowDefinition.
      Specified by:
      configure in interface IntegrationFlow
      Parameters:
      flow - the IntegrationFlowDefinition to configure
    • getInputChannel

      public org.springframework.messaging.MessageChannel getInputChannel()
      Description copied from interface: IntegrationFlow
      Return the first MessageChannel component which is essentially a flow input channel.
      Specified by:
      getInputChannel in interface IntegrationFlow
      Returns:
      the channel.
    • setIntegrationComponents

      public void setIntegrationComponents(Map<Object,String> integrationComponents)
    • getIntegrationComponents

      public Map<Object,String> getIntegrationComponents()
      Description copied from interface: IntegrationFlow
      Return a map of integration components managed by this flow (if any).
      Specified by:
      getIntegrationComponents in interface IntegrationFlow
      Returns:
      the map of integration components managed by this flow.
    • start

      public void start()
      Specified by:
      start in interface org.springframework.context.Lifecycle
    • stop

      public void stop(Runnable callback)
      Specified by:
      stop in interface org.springframework.context.SmartLifecycle
    • stop

      public void stop()
      Specified by:
      stop in interface org.springframework.context.Lifecycle
    • isRunning

      public boolean isRunning()
      Specified by:
      isRunning in interface org.springframework.context.Lifecycle
    • isAutoStartup

      public boolean isAutoStartup()
      Specified by:
      isAutoStartup in interface org.springframework.context.SmartLifecycle
    • getPhase

      public int getPhase()
      Specified by:
      getPhase in interface org.springframework.context.Phased
      Specified by:
      getPhase in interface org.springframework.context.SmartLifecycle
    • toString

      public String toString()
      Overrides:
      toString in class Object