Interface IntegrationFlowContext
- All Known Implementing Classes:
StandardIntegrationFlowContext
public interface IntegrationFlowContext
A public API for dynamic (manual) registration of
IntegrationFlow
s,
not via standard bean registration phase.
The bean of this component is provided via framework automatically. A bean name is based on the decapitalized class name. It must be injected to the target service before use.
The typical use-case, and, therefore algorithm, is:
- create an
IntegrationFlow
instance depending of the business logic - register that
IntegrationFlow
in thisIntegrationFlowContext
, with optionalid
andautoStartup
flag - obtain a
MessagingTemplate
for thatIntegrationFlow
(if it is started from theMessageChannel
) and send (or send-and-receive) messages to theIntegrationFlow
- remove the
IntegrationFlow
by itsid
from thisIntegrationFlowContext
For convenience an associated IntegrationFlowContext.IntegrationFlowRegistration
is returned after registration.
It can be used for access to the target IntegrationFlow
or for manipulation with its lifecycle.
- Since:
- 5.0
- Author:
- Artem Bilan, Gary Russell, Artem Vozhdayenko
- See Also:
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
static interface
A Builder pattern implementation for the options to registerIntegrationFlow
in the application context. -
Method Summary
Modifier and TypeMethodDescriptiongetRegistrationById
(String flowId) Obtain anIntegrationFlowContext.IntegrationFlowRegistration
for theIntegrationFlow
associated with the providedflowId
.Provide the state of the mapping of integration flow names to theirIntegrationFlowContext.IntegrationFlowRegistration
instances.default boolean
isUseIdAsPrefix
(String flowId) Return true to prefix flow bean names with the flow id and a period.messagingTemplateFor
(String flowId) Obtain aMessagingTemplate
with its default destination set to the input channel of theIntegrationFlow
for providedflowId
.registration
(IntegrationFlow integrationFlow) Associate providedIntegrationFlow
with anIntegrationFlowContext.IntegrationFlowRegistrationBuilder
for additional options and farther registration in the application context.void
Destroy anIntegrationFlow
bean (as well as all its dependant beans) for providedflowId
and clean up all the local cache for it.
-
Method Details
-
registration
IntegrationFlowContext.IntegrationFlowRegistrationBuilder registration(IntegrationFlow integrationFlow) Associate providedIntegrationFlow
with anIntegrationFlowContext.IntegrationFlowRegistrationBuilder
for additional options and farther registration in the application context.- Parameters:
integrationFlow
- theIntegrationFlow
to register- Returns:
- the IntegrationFlowRegistrationBuilder associated with the provided
IntegrationFlow
-
getRegistrationById
Obtain anIntegrationFlowContext.IntegrationFlowRegistration
for theIntegrationFlow
associated with the providedflowId
.- Parameters:
flowId
- the bean name to obtain- Returns:
- the IntegrationFlowRegistration for provided
id
ornull
-
remove
Destroy anIntegrationFlow
bean (as well as all its dependant beans) for providedflowId
and clean up all the local cache for it.- Parameters:
flowId
- the bean name to destroy from
-
messagingTemplateFor
Obtain aMessagingTemplate
with its default destination set to the input channel of theIntegrationFlow
for providedflowId
.Any
IntegrationFlow
bean (not only manually registered) can be used for this method.If
IntegrationFlow
doesn't start with theMessageChannel
, theIllegalStateException
is thrown.- Parameters:
flowId
- the bean name to obtain the input channel from- Returns:
- the
MessagingTemplate
instance
-
getRegistry
Map<String,IntegrationFlowContext.IntegrationFlowRegistration> getRegistry()Provide the state of the mapping of integration flow names to theirIntegrationFlowContext.IntegrationFlowRegistration
instances.- Returns:
- the registry of flow ids and their registration.
-
isUseIdAsPrefix
Return true to prefix flow bean names with the flow id and a period.- Parameters:
flowId
- the flow id.- Returns:
- true to use as a prefix.
- Since:
- 5.0.6
-