Class AbstractMessageProducingHandler
java.lang.Object
org.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.handler.MessageHandlerSupport
org.springframework.integration.handler.AbstractMessageHandler
org.springframework.integration.handler.AbstractMessageProducingHandler
- All Implemented Interfaces:
- org.reactivestreams.Subscriber<Message<?>>,- Aware,- BeanFactoryAware,- BeanNameAware,- DisposableBean,- InitializingBean,- ApplicationContextAware,- Ordered,- ComponentSourceAware,- ExpressionCapable,- Orderable,- MessageProducer,- HeaderPropagationAware,- IntegrationPattern,- NamedComponent,- IntegrationManagement,- TrackableComponent,- MessageHandler,- reactor.core.CoreSubscriber<Message<?>>
- Direct Known Subclasses:
- AbstractCorrelatingMessageHandler,- AbstractReplyProducingMessageHandler,- FluxAggregatorMessageHandler,- MessageHandlerChain,- MockMessageHandler
public abstract class AbstractMessageProducingHandler
extends AbstractMessageHandler
implements MessageProducer, HeaderPropagationAware
The base 
AbstractMessageHandler implementation for the MessageProducer.- Since:
- 4.1
- Author:
- David Liu, Artem Bilan, Gary Russell, Marius Bogoevici, Ngoc Nhan
- 
Nested Class SummaryNested classes/interfaces inherited from interface org.springframework.integration.support.management.IntegrationManagementIntegrationManagement.ManagementOverrides
- 
Field SummaryFieldsFields 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 TypeMethodDescriptionvoidaddNotPropagatedHeaders(String... headers) Add header patterns ("xxx*", "*xxx", "*xxx*" or "xxx*yyy") that will NOT be copied from the inbound message ifshouldCopyRequestHeaders()is true, instead of overwriting the existing set.protected Message<?> createOutputMessage(Object output, MessageHeaders requestHeaders) Get the header patterns this handler doesn't propagate.@Nullable MessageChannelReturn the output channel.protected booleanisAsync()protected AbstractIntegrationMessageBuilder<?> messageBuilderForReply(Object reply) protected voidonInit()Subclasses may implement this for initialization logic.protected voidproduceOutput(Object replyArg, Message<?> requestMessage) protected ObjectresolveErrorChannel(MessageHeaders requestHeaders) protected voidsendErrorMessage(Message<?> requestMessage, Throwable ex) protected voidsendOutput(Object output, @Nullable Object replyChannelArg, boolean useArgChannel) Send an output Message.protected voidsendOutputs(Object result, Message<?> requestMessage) final voidsetAsync(boolean async) Allow async replies.voidsetNotPropagatedHeaders(String... headers) Set header patterns ("xxx*", "*xxx", "*xxx*" or "xxx*yyy") that will NOT be copied from the inbound message ifshouldCopyRequestHeaadersis true.voidsetOutputChannel(MessageChannel outputChannel) Specify theMessageChannelto which produced Messages should be sent.voidsetOutputChannelName(String outputChannelName) Specify the bean name of theMessageChannelto which produced Messages should be sent.voidsetSendTimeout(long sendTimeout) Set the timeout for sending reply Messages.protected voidsetupMessageProcessor(MessageProcessor<?> processor) protected booleanSubclasses may override this.protected booleanshouldSplitOutput(Iterable<?> reply) protected final voidupdateNotPropagatedHeaders(String[] headers, boolean merge) Set or replace not propagated headers.Methods inherited from class org.springframework.integration.handler.AbstractMessageHandlerhandleMessage, handleMessageInternal, onComplete, onError, onNext, onSubscribe, setObservationConventionMethods inherited from class org.springframework.integration.handler.MessageHandlerSupportbuildSendTimer, destroy, getComponentType, getIntegrationPatternType, 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, getComponentDescription, getComponentName, getComponentSource, getConversionService, getExpression, getIntegrationProperties, getMessageBuilderFactory, getTaskScheduler, isInitialized, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentDescription, setComponentName, setComponentSource, 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.integration.support.context.NamedComponentgetBeanName, getComponentName
- 
Field Details- 
messagingTemplate
 
- 
- 
Constructor Details- 
AbstractMessageProducingHandlerpublic AbstractMessageProducingHandler()
 
- 
- 
Method Details- 
setSendTimeoutpublic void setSendTimeout(long sendTimeout) Set the timeout for sending reply Messages.- Parameters:
- sendTimeout- The send timeout.
 
- 
setOutputChannelDescription copied from interface:MessageProducerSpecify theMessageChannelto which produced Messages should be sent.- Specified by:
- setOutputChannelin interface- MessageProducer
- Parameters:
- outputChannel- The output channel.
 
- 
setOutputChannelNameDescription copied from interface:MessageProducerSpecify the bean name of theMessageChannelto which produced Messages should be sent.- Specified by:
- setOutputChannelNamein interface- MessageProducer
- Parameters:
- outputChannelName- The output channel bean name.
 
- 
setAsyncpublic final void setAsync(boolean async) Allow async replies. If the handler reply is aCompletableFutureorPublisher, send the output when it is satisfied rather than sending the future as the result. Ignored for return types other thanCompletableFutureorPublisher.- Parameters:
- async- true to allow.
- Since:
- 4.3
 
- 
isAsyncprotected boolean isAsync()- Returns:
- true if this handler supports async replies.
- Since:
- 4.3
- See Also:
 
- 
setNotPropagatedHeadersSet header patterns ("xxx*", "*xxx", "*xxx*" or "xxx*yyy") that will NOT be copied from the inbound message ifshouldCopyRequestHeaadersis true. At least one pattern as "*" means do not copy headers at all.- Specified by:
- setNotPropagatedHeadersin interface- HeaderPropagationAware
- Parameters:
- headers- the headers to not propagate from the inbound message.
- Since:
- 4.3.10
- See Also:
 
- 
updateNotPropagatedHeadersSet or replace not propagated headers. Exposed so that subclasses can set specific headers in a constructor, sincesetNotPropagatedHeaders(String...)is not final.- Parameters:
- headers- Header patterns to not propagate.
- merge- true to merge with existing patterns; false to replace.
- Since:
- 5.0.2
 
- 
getNotPropagatedHeadersGet the header patterns this handler doesn't propagate.- Specified by:
- getNotPropagatedHeadersin interface- HeaderPropagationAware
- Returns:
- an immutable Collectionof headers that will not be copied from the inbound message ifshouldCopyRequestHeaders()is true.
- Since:
- 4.3.10
- See Also:
 
- 
addNotPropagatedHeadersAdd header patterns ("xxx*", "*xxx", "*xxx*" or "xxx*yyy") that will NOT be copied from the inbound message ifshouldCopyRequestHeaders()is true, instead of overwriting the existing set.- Specified by:
- addNotPropagatedHeadersin interface- HeaderPropagationAware
- Parameters:
- headers- the headers to not propagate from the inbound message.
- Since:
- 4.3.10
- See Also:
 
- 
onInitprotected void onInit()Description copied from class:IntegrationObjectSupportSubclasses may implement this for initialization logic.- Overrides:
- onInitin class- IntegrationObjectSupport
 
- 
getOutputChannelDescription copied from interface:MessageProducerReturn the output channel.- Specified by:
- getOutputChannelin interface- MessageProducer
- Returns:
- the channel.
 
- 
sendOutputs
- 
shouldSplitOutput
- 
produceOutput
- 
messageBuilderForReply
- 
createOutputMessage
- 
sendOutputSend an output Message. The 'replyChannel' will be considered only if this handler's 'outputChannel' isnull. In that case, the 'replyChannel' value must not also benull, and it must be an instance of either String orMessageChannel.- Parameters:
- output- the output object to send
- replyChannelArg- the 'replyChannel' value from the original request
- useArgChannel- use the replyChannel argument (must not be null), not the configured output channel.
 
- 
shouldCopyRequestHeadersprotected boolean shouldCopyRequestHeaders()Subclasses may override this. True by default.- Returns:
- true if the request headers should be copied.
 
- 
sendErrorMessage
- 
resolveErrorChannel
- 
setupMessageProcessor
 
-