Class StandardIntegrationFlow
- All Implemented Interfaces:
Aware
,BeanNameAware
,Lifecycle
,Phased
,SmartLifecycle
,ComponentSourceAware
,IntegrationFlow
,NamedComponent
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
- Author:
- Artem Bilan
- See Also:
-
Field Summary
Fields inherited from interface org.springframework.context.SmartLifecycle
DEFAULT_PHASE
-
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
.Return the bean name populated by theBeanNameAware.setBeanName(String)
.Return a human-readable description of this bean.Return the configuration sourceObject
for this bean (maybenull
).Return the firstMessageChannel
component which is essentially a flow input channel.Return a map of integration components managed by this flow (if any).int
getPhase()
boolean
boolean
void
setBeanName
(String name) void
setComponentDescription
(String description) Set a human-readable description of this bean.void
setComponentSource
(Object source) Set a configuration sourceObject
for this bean definition.void
setIntegrationComponents
(Map<Object, String> integrationComponents) void
start()
void
stop()
void
toString()
-
Method Details
-
setBeanName
- Specified by:
setBeanName
in interfaceBeanNameAware
-
getComponentName
- Specified by:
getComponentName
in interfaceNamedComponent
-
getComponentType
- Specified by:
getComponentType
in interfaceNamedComponent
-
setComponentSource
Description copied from interface:ComponentSourceAware
Set a configuration sourceObject
for this bean definition. For normalBeanDefinition
this is supplied by application context automatically. Could be useful when bean is registered at runtime viaSingletonBeanRegistry.registerSingleton(String, Object)
- Specified by:
setComponentSource
in interfaceComponentSourceAware
- Parameters:
source
- the configuration source
-
getComponentSource
Description copied from interface:ComponentSourceAware
Return the configuration sourceObject
for this bean (maybenull
). Usually (if not set explicitly) aBeanMetadataElement.getSource()
.- Specified by:
getComponentSource
in interfaceComponentSourceAware
- Returns:
- the configuration source for the bean (if any).
-
setComponentDescription
Description copied from interface:ComponentSourceAware
Set a human-readable description of this bean. For normal bean definition aBeanDefinition.getDescription()
is used.- Specified by:
setComponentDescription
in interfaceComponentSourceAware
- Parameters:
description
- the bean description
-
getComponentDescription
Description copied from interface:ComponentSourceAware
Return a human-readable description of this bean. Usually (if not set explicitly) aBeanDefinition.getDescription()
.- Specified by:
getComponentDescription
in interfaceComponentSourceAware
- Returns:
- the bean description (if any).
-
getBeanName
Description copied from interface:ComponentSourceAware
Return the bean name populated by theBeanNameAware.setBeanName(String)
.- Specified by:
getBeanName
in interfaceComponentSourceAware
- Specified by:
getBeanName
in interfaceNamedComponent
- Returns:
- the bean name.
-
configure
Description copied from interface:IntegrationFlow
The callback-based function to declare the chain of EIP-methods to configure an integration flow with the providedIntegrationFlowDefinition
.- Specified by:
configure
in interfaceIntegrationFlow
- Parameters:
flow
- theIntegrationFlowDefinition
to configure
-
getInputChannel
Description copied from interface:IntegrationFlow
Return the firstMessageChannel
component which is essentially a flow input channel.- Specified by:
getInputChannel
in interfaceIntegrationFlow
- Returns:
- the channel.
-
setIntegrationComponents
-
getIntegrationComponents
Description copied from interface:IntegrationFlow
Return a map of integration components managed by this flow (if any).- Specified by:
getIntegrationComponents
in interfaceIntegrationFlow
- Returns:
- the map of integration components managed by this flow.
-
start
public void start() -
stop
- Specified by:
stop
in interfaceSmartLifecycle
-
stop
public void stop() -
isRunning
public boolean isRunning() -
isAutoStartup
public boolean isAutoStartup()- Specified by:
isAutoStartup
in interfaceSmartLifecycle
-
getPhase
public int getPhase()- Specified by:
getPhase
in interfacePhased
- Specified by:
getPhase
in interfaceSmartLifecycle
-
toString
-