public final class IntegrationFlowContext
extends java.lang.Object
implements org.springframework.beans.factory.BeanFactoryAware
IntegrationFlow,
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:
IntegrationFlow depending of the business logic
IntegrationFlow in this IntegrationFlowContext,
with optional id and autoStartup flag
MessagingTemplate for that IntegrationFlow
(if it is started from the MessageChannel) and send (or send-and-receive)
messages to the IntegrationFlow
IntegrationFlow by its id from this IntegrationFlowContext
For convenience an associated IntegrationFlowRegistration is returned after registration.
It can be used for access to the target IntegrationFlow or for manipulation with its lifecycle.
IntegrationFlowRegistration| Modifier and Type | Class and Description |
|---|---|
class |
IntegrationFlowContext.IntegrationFlowRegistrationBuilder
A Builder pattern implementation for the options to register
IntegrationFlow
in the application context. |
| Modifier and Type | Method and Description |
|---|---|
IntegrationFlowRegistration |
getRegistrationById(java.lang.String flowId)
|
org.springframework.integration.core.MessagingTemplate |
messagingTemplateFor(java.lang.String flowId)
Obtain a
MessagingTemplate with its default destination set to the input channel
of the IntegrationFlow for provided flowId. |
IntegrationFlowContext.IntegrationFlowRegistrationBuilder |
registration(IntegrationFlow integrationFlow)
Associate provided
IntegrationFlow with an IntegrationFlowContext.IntegrationFlowRegistrationBuilder
for additional options and farther registration in the application context. |
void |
remove(java.lang.String flowId)
Destroy an
IntegrationFlow bean (as well as all its dependant beans)
for provided flowId and clean up all the local cache for it. |
void |
setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory) |
public void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
throws org.springframework.beans.BeansException
setBeanFactory in interface org.springframework.beans.factory.BeanFactoryAwareorg.springframework.beans.BeansExceptionpublic IntegrationFlowContext.IntegrationFlowRegistrationBuilder registration(IntegrationFlow integrationFlow)
IntegrationFlow with an IntegrationFlowContext.IntegrationFlowRegistrationBuilder
for additional options and farther registration in the application context.integrationFlow - the IntegrationFlow to registerIntegrationFlowpublic IntegrationFlowRegistration getRegistrationById(java.lang.String flowId)
flowId - the bean name to obtainid or nullpublic void remove(java.lang.String flowId)
IntegrationFlow bean (as well as all its dependant beans)
for provided flowId and clean up all the local cache for it.flowId - the bean name to destroy frompublic org.springframework.integration.core.MessagingTemplate messagingTemplateFor(java.lang.String flowId)
MessagingTemplate with its default destination set to the input channel
of the IntegrationFlow for provided flowId.
Any IntegrationFlow bean (not only manually registered) can be used for this method.
If IntegrationFlow doesn't start with the MessageChannel, the
IllegalStateException is thrown.
flowId - the bean name to obtain the input channel fromMessagingTemplate instance