Class MessageHandlerChain
java.lang.Object
org.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.handler.MessageHandlerSupport
org.springframework.integration.handler.AbstractMessageHandler
org.springframework.integration.handler.AbstractMessageProducingHandler
org.springframework.integration.handler.MessageHandlerChain
- All Implemented Interfaces:
- org.reactivestreams.Subscriber<Message<?>>,- Aware,- BeanFactoryAware,- BeanNameAware,- DisposableBean,- InitializingBean,- ApplicationContextAware,- Lifecycle,- Ordered,- ExpressionCapable,- Orderable,- MessageProducer,- CompositeMessageHandler,- HeaderPropagationAware,- IntegrationPattern,- NamedComponent,- IntegrationManagement,- ManageableLifecycle,- TrackableComponent,- MessageHandler,- reactor.core.CoreSubscriber<Message<?>>
public class MessageHandlerChain
extends AbstractMessageProducingHandler
implements CompositeMessageHandler, ManageableLifecycle
A composite 
MessageHandler implementation that invokes a chain of
 MessageHandler instances in order.
 
 Each of the handlers except for the last one must implement the
 MessageProducer interface. The last handler must also if
 the chain itself has an output channel configured. No other assumptions
 are made about the type of handler.
 
 It is expected that each handler will produce reply messages and send them to
 its output channel, although this is not enforced. It is possible to filter
 messages in the middle of the chain, for example using a
 MessageFilter.
 A MessageHandler returning null will have the
 same effect, although this option is less expressive.
 
This component can be used from the namespace to improve the readability of the configuration by removing channels that can be created implicitly.
 
 <chain>
     <filter ref="someFilter"/>
     <bean class="SomeMessageHandlerImplementation"/>
     <transformer ref="someTransformer"/>
     <aggregator ... />
 </chain>
 
 - Author:
- Mark Fisher, Iwein Fuld, Gary Russell, Artem Bilan, Trung Pham, Christian Tzolov
- 
Nested Class SummaryNested classes/interfaces inherited from interface org.springframework.integration.support.management.IntegrationManagementIntegrationManagement.ManagementOverrides
- 
Field SummaryFields inherited from class org.springframework.integration.handler.AbstractMessageProducingHandlermessagingTemplateFields inherited from class org.springframework.integration.context.IntegrationObjectSupportEXPRESSION_PARSER, loggerFields inherited from interface org.springframework.integration.support.management.IntegrationManagementMETER_PREFIX, RECEIVE_COUNTER_NAME, SEND_TIMER_NAMEFields inherited from interface org.springframework.core.OrderedHIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionSubclasses may implement this method to provide component type information.Return an unmodifiable list of handlers.Return a pattern type this component implements.protected voidhandleMessageInternal(Message<?> message) final booleanprotected voidonInit()Subclasses may implement this for initialization logic.voidsetHandlers(List<MessageHandler> handlers) protected booleanSubclasses may override this.final voidstart()final voidstop()final voidMethods inherited from class org.springframework.integration.handler.AbstractMessageProducingHandleraddNotPropagatedHeaders, createOutputMessage, getNotPropagatedHeaders, getOutputChannel, isAsync, messageBuilderForReply, produceOutput, resolveErrorChannel, sendErrorMessage, sendOutput, sendOutputs, setAsync, setNotPropagatedHeaders, setOutputChannel, setOutputChannelName, setSendTimeout, setupMessageProcessor, shouldSplitOutput, updateNotPropagatedHeadersMethods inherited from class org.springframework.integration.handler.AbstractMessageHandlerhandleMessage, onComplete, onError, onNext, onSubscribe, setObservationConventionMethods inherited from class org.springframework.integration.handler.MessageHandlerSupportbuildSendTimer, destroy, getManagedName, getManagedType, getMetricsCaptor, getObservationRegistry, getOrder, getOverrides, isLoggingEnabled, isObserved, registerMetricsCaptor, registerObservationRegistry, sendTimer, setLoggingEnabled, setManagedName, setManagedType, setOrder, setShouldTrack, shouldTrackMethods inherited from class org.springframework.integration.context.IntegrationObjectSupportafterPropertiesSet, extractTypeIfPossible, generateId, getApplicationContext, getApplicationContextId, getBeanDescription, getBeanFactory, getBeanName, getChannelResolver, getComponentName, getConversionService, getExpression, getIntegrationProperties, getMessageBuilderFactory, getTaskScheduler, isInitialized, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentName, setConversionService, setMessageBuilderFactory, setPrimaryExpression, setTaskScheduler, toStringMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface reactor.core.CoreSubscribercurrentContextMethods inherited from interface org.springframework.integration.support.management.IntegrationManagementgetThisAsMethods inherited from interface org.springframework.messaging.MessageHandlerhandleMessageMethods inherited from interface org.springframework.integration.support.context.NamedComponentgetBeanName, getComponentName
- 
Constructor Details- 
MessageHandlerChainpublic MessageHandlerChain()
 
- 
- 
Method Details- 
setHandlers
- 
getHandlersDescription copied from interface:CompositeMessageHandlerReturn an unmodifiable list of handlers.- Specified by:
- getHandlersin interface- CompositeMessageHandler
- Returns:
- the handlers.
 
- 
getComponentTypeDescription copied from class:IntegrationObjectSupportSubclasses may implement this method to provide component type information.- Specified by:
- getComponentTypein interface- NamedComponent
- Overrides:
- getComponentTypein class- MessageHandlerSupport
 
- 
getIntegrationPatternTypeDescription copied from interface:IntegrationPatternReturn a pattern type this component implements.- Specified by:
- getIntegrationPatternTypein interface- IntegrationPattern
- Overrides:
- getIntegrationPatternTypein class- MessageHandlerSupport
- Returns:
- the IntegrationPatternTypethis component implements.
 
- 
onInitprotected void onInit()Description copied from class:IntegrationObjectSupportSubclasses may implement this for initialization logic.- Overrides:
- onInitin class- AbstractMessageProducingHandler
 
- 
handleMessageInternal- Specified by:
- handleMessageInternalin class- AbstractMessageHandler
 
- 
shouldCopyRequestHeadersprotected boolean shouldCopyRequestHeaders()Description copied from class:AbstractMessageProducingHandlerSubclasses may override this. True by default.- Overrides:
- shouldCopyRequestHeadersin class- AbstractMessageProducingHandler
- Returns:
- true if the request headers should be copied.
 
- 
isRunningpublic final boolean isRunning()- Specified by:
- isRunningin interface- Lifecycle
- Specified by:
- isRunningin interface- ManageableLifecycle
 
- 
startpublic final void start()- Specified by:
- startin interface- Lifecycle
- Specified by:
- startin interface- ManageableLifecycle
 
- 
stoppublic final void stop()- Specified by:
- stopin interface- Lifecycle
- Specified by:
- stopin interface- ManageableLifecycle
 
- 
stop
 
-