Interface IntegrationFlowContext
- All Known Implementing Classes:
StandardIntegrationFlowContext
public interface IntegrationFlowContext
A public API for dynamic (manual) registration of
IntegrationFlows,
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
IntegrationFlowinstance depending of the business logic - register that
IntegrationFlowin thisIntegrationFlowContext, with optionalidandautoStartupflag - obtain a
MessagingTemplatefor thatIntegrationFlow(if it is started from theMessageChannel) and send (or send-and-receive) messages to theIntegrationFlow - remove the
IntegrationFlowby itsidfrom 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:
IntegrationFlowContext.IntegrationFlowRegistration
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceIntegrationFlowContext.IntegrationFlowRegistrationstatic interfaceIntegrationFlowContext.IntegrationFlowRegistrationBuilderA Builder pattern implementation for the options to registerIntegrationFlowin the application context. -
Method Summary
Modifier and Type Method Description IntegrationFlowContext.IntegrationFlowRegistrationgetRegistrationById(String flowId)Obtain anIntegrationFlowContext.IntegrationFlowRegistrationfor theIntegrationFlowassociated with the providedflowId.Map<String,IntegrationFlowContext.IntegrationFlowRegistration>getRegistry()Provide the state of the mapping of integration flow names to theirIntegrationFlowContext.IntegrationFlowRegistrationinstances.default booleanisUseIdAsPrefix(String flowId)Return true to prefix flow bean names with the flow id and a period.MessagingTemplatemessagingTemplateFor(String flowId)Obtain aMessagingTemplatewith its default destination set to the input channel of theIntegrationFlowfor providedflowId.IntegrationFlowContext.IntegrationFlowRegistrationBuilderregistration(IntegrationFlow integrationFlow)Associate providedIntegrationFlowwith anIntegrationFlowContext.IntegrationFlowRegistrationBuilderfor additional options and farther registration in the application context.voidremove(String flowId)Destroy anIntegrationFlowbean (as well as all its dependant beans) for providedflowIdand clean up all the local cache for it.
-
Method Details
-
registration
IntegrationFlowContext.IntegrationFlowRegistrationBuilder registration(IntegrationFlow integrationFlow)Associate providedIntegrationFlowwith anIntegrationFlowContext.IntegrationFlowRegistrationBuilderfor additional options and farther registration in the application context.- Parameters:
integrationFlow- theIntegrationFlowto register- Returns:
- the IntegrationFlowRegistrationBuilder associated with the provided
IntegrationFlow
-
getRegistrationById
Obtain anIntegrationFlowContext.IntegrationFlowRegistrationfor theIntegrationFlowassociated with the providedflowId.- Parameters:
flowId- the bean name to obtain- Returns:
- the IntegrationFlowRegistration for provided
idornull
-
remove
Destroy anIntegrationFlowbean (as well as all its dependant beans) for providedflowIdand clean up all the local cache for it.- Parameters:
flowId- the bean name to destroy from
-
messagingTemplateFor
Obtain aMessagingTemplatewith its default destination set to the input channel of theIntegrationFlowfor providedflowId.Any
IntegrationFlowbean (not only manually registered) can be used for this method.If
IntegrationFlowdoesn't start with theMessageChannel, theIllegalStateExceptionis thrown.- Parameters:
flowId- the bean name to obtain the input channel from- Returns:
- the
MessagingTemplateinstance
-
getRegistry
Map<String,IntegrationFlowContext.IntegrationFlowRegistration> getRegistry()Provide the state of the mapping of integration flow names to theirIntegrationFlowContext.IntegrationFlowRegistrationinstances.- 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
-