public abstract class AbstractMessageProducingHandler extends AbstractMessageHandler implements MessageProducer, HeaderPropagationAware
AbstractMessageHandler
implementation for the MessageProducer
.IntegrationManagement.ManagementOverrides
Modifier and Type | Field and Description |
---|---|
protected MessagingTemplate |
messagingTemplate |
EXPRESSION_PARSER, logger
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
METER_PREFIX, RECEIVE_COUNTER_NAME, SEND_TIMER_NAME
Constructor and Description |
---|
AbstractMessageProducingHandler() |
Modifier and Type | Method and Description |
---|---|
void |
addNotPropagatedHeaders(String... headers)
Add header patterns ("xxx*", "*xxx", "*xxx*" or "xxx*yyy")
that will NOT be copied from the inbound message if
shouldCopyRequestHeaders() is true, instead of overwriting the existing
set. |
protected Message<?> |
createOutputMessage(Object output,
MessageHeaders requestHeaders) |
Collection<String> |
getNotPropagatedHeaders()
Get the header patterns this handler doesn't propagate.
|
MessageChannel |
getOutputChannel()
Return the the output channel.
|
protected boolean |
isAsync() |
protected AbstractIntegrationMessageBuilder<?> |
messageBuilderForReply(Object reply) |
protected void |
onInit()
Subclasses may implement this for initialization logic.
|
protected void |
produceOutput(Object replyArg,
Message<?> requestMessage) |
protected Object |
resolveErrorChannel(MessageHeaders requestHeaders) |
protected void |
sendErrorMessage(Message<?> requestMessage,
Throwable ex) |
protected void |
sendOutput(Object output,
Object replyChannelArg,
boolean useArgChannel)
Send an output Message.
|
protected void |
sendOutputs(Object result,
Message<?> requestMessage) |
void |
setAsync(boolean async)
Allow async replies.
|
void |
setNotPropagatedHeaders(String... headers)
Set header patterns ("xxx*", "*xxx", "*xxx*" or "xxx*yyy")
that will NOT be copied from the inbound message if
shouldCopyRequestHeaaders is true. |
void |
setOutputChannel(MessageChannel outputChannel)
Specify the
MessageChannel to which produced Messages should be sent. |
void |
setOutputChannelName(String outputChannelName)
Specify the bean name of the
MessageChannel to which produced Messages should be sent. |
void |
setSendTimeout(long sendTimeout)
Set the timeout for sending reply Messages.
|
protected boolean |
shouldCopyRequestHeaders()
Subclasses may override this.
|
protected boolean |
shouldSplitOutput(Iterable<?> reply) |
protected void |
updateNotPropagatedHeaders(String[] headers,
boolean merge)
Set or replace not propagated headers.
|
handleMessage, handleMessageInternal, onComplete, onError, onNext, onSubscribe
buildSendTimer, destroy, getComponentType, getIntegrationPatternType, getManagedName, getManagedType, getMetricsCaptor, getOrder, getOverrides, isLoggingEnabled, registerMetricsCaptor, sendTimer, setLoggingEnabled, setManagedName, setManagedType, setOrder, setShouldTrack, shouldTrack
afterPropertiesSet, extractTypeIfPossible, generateId, getApplicationContext, getApplicationContextId, getBeanDescription, getBeanFactory, getBeanName, getChannelResolver, getComponentName, getConversionService, getExpression, getIntegrationProperties, getIntegrationProperty, getMessageBuilderFactory, getTaskScheduler, isInitialized, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentName, setConversionService, setMessageBuilderFactory, setPrimaryExpression, setTaskScheduler, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getThisAs
getBeanName, getComponentName
protected final MessagingTemplate messagingTemplate
public void setSendTimeout(long sendTimeout)
sendTimeout
- The send timeout.public void setOutputChannel(MessageChannel outputChannel)
MessageProducer
MessageChannel
to which produced Messages should be sent.setOutputChannel
in interface MessageProducer
outputChannel
- The output channel.public void setOutputChannelName(String outputChannelName)
MessageProducer
MessageChannel
to which produced Messages should be sent.setOutputChannelName
in interface MessageProducer
outputChannelName
- The output channel bean name.public final void setAsync(boolean async)
ListenableFuture
, send
the output when it is satisfied rather than sending the future as the result.
Ignored for return types other than ListenableFuture
.async
- true to allow.protected boolean isAsync()
setAsync(boolean)
public void setNotPropagatedHeaders(String... headers)
shouldCopyRequestHeaaders
is true.
At least one pattern as "*" means do not copy headers at all.setNotPropagatedHeaders
in interface HeaderPropagationAware
headers
- the headers to not propagate from the inbound message.PatternMatchUtils
protected final void updateNotPropagatedHeaders(String[] headers, boolean merge)
setNotPropagatedHeaders(String...)
is not
final.headers
- Header patterns to not propagate.merge
- true to merge with existing patterns; false to replace.public Collection<String> getNotPropagatedHeaders()
getNotPropagatedHeaders
in interface HeaderPropagationAware
Collection
of headers that will not be
copied from the inbound message if shouldCopyRequestHeaders()
is true.setNotPropagatedHeaders(String...)
,
PatternMatchUtils
public void addNotPropagatedHeaders(String... headers)
shouldCopyRequestHeaders()
is true, instead of overwriting the existing
set.addNotPropagatedHeaders
in interface HeaderPropagationAware
headers
- the headers to not propagate from the inbound message.setNotPropagatedHeaders(String...)
protected void onInit()
IntegrationObjectSupport
onInit
in class IntegrationObjectSupport
@Nullable public MessageChannel getOutputChannel()
MessageProducer
getOutputChannel
in interface MessageProducer
protected boolean shouldSplitOutput(Iterable<?> reply)
protected AbstractIntegrationMessageBuilder<?> messageBuilderForReply(Object reply)
protected Message<?> createOutputMessage(Object output, MessageHeaders requestHeaders)
protected void sendOutput(Object output, @Nullable Object replyChannelArg, boolean useArgChannel)
null
. In that case, the 'replyChannel' value must not also be
null
, and it must be an instance of either String or MessageChannel
.output
- the output object to sendreplyChannelArg
- the 'replyChannel' value from the original requestuseArgChannel
- - use the replyChannel argument (must not be null), not
the configured output channel.protected boolean shouldCopyRequestHeaders()
protected Object resolveErrorChannel(MessageHeaders requestHeaders)