public abstract class MessageProducerSupport extends AbstractEndpoint implements MessageProducer, TrackableComponent, org.springframework.beans.factory.SmartInitializingSingleton
lifecycleCondition, lifecycleLock
EXPRESSION_PARSER, logger
Modifier | Constructor and Description |
---|---|
protected |
MessageProducerSupport() |
Modifier and Type | Method and Description |
---|---|
void |
afterSingletonsInstantiated() |
protected org.springframework.messaging.support.ErrorMessage |
buildErrorMessage(org.springframework.messaging.Message<?> message,
java.lang.RuntimeException exception)
Build an error message for the exception and message using the configured
ErrorMessageStrategy . |
protected void |
doStart()
Takes no action by default.
|
protected void |
doStop()
Takes no action by default.
|
org.springframework.messaging.MessageChannel |
getErrorChannel()
Return the error channel (if provided) to which error messages will
be routed.
|
protected org.springframework.core.AttributeAccessor |
getErrorMessageAttributes(org.springframework.messaging.Message<?> message)
Populate an
AttributeAccessor to be used when building an error message
with the errorMessageStrategy . |
protected MessagingTemplate |
getMessagingTemplate() |
org.springframework.messaging.MessageChannel |
getOutputChannel()
Return the the output channel.
|
protected void |
onInit()
Subclasses may implement this for initialization logic.
|
protected boolean |
sendErrorMessageIfNecessary(org.springframework.messaging.Message<?> message,
java.lang.RuntimeException exception)
Send an error message based on the exception and message.
|
protected void |
sendMessage(org.springframework.messaging.Message<?> message) |
void |
setErrorChannel(org.springframework.messaging.MessageChannel errorChannel) |
void |
setErrorChannelName(java.lang.String errorChannelName)
Set the error channel name.
|
void |
setErrorMessageStrategy(ErrorMessageStrategy errorMessageStrategy)
Set an
ErrorMessageStrategy to use to build an error message when a exception occurs. |
void |
setOutputChannel(org.springframework.messaging.MessageChannel outputChannel)
Specify the MessageChannel to which produced Messages should be sent.
|
void |
setOutputChannelName(java.lang.String outputChannelName)
Set the output channel name; overrides
outputChannel if provided. |
void |
setSendTimeout(long sendTimeout)
Configure the default timeout value to use for send operations.
|
void |
setShouldTrack(boolean shouldTrack) |
destroy, doStop, getPhase, getRole, isAutoStartup, isRunning, setAutoStartup, setPhase, setRole, setTaskScheduler, start, stop, stop
afterPropertiesSet, extractTypeIfPossible, getApplicationContext, getApplicationContextId, getBeanFactory, getChannelResolver, getComponentName, getComponentType, getConversionService, getExpression, getIntegrationProperties, getIntegrationProperty, getMessageBuilderFactory, getTaskScheduler, isInitialized, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentName, setConversionService, setMessageBuilderFactory, setPrimaryExpression, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getComponentName, getComponentType
public void setOutputChannel(org.springframework.messaging.MessageChannel outputChannel)
MessageProducer
setOutputChannel
in interface MessageProducer
outputChannel
- The output channel.public void setOutputChannelName(java.lang.String outputChannelName)
outputChannel
if provided.outputChannelName
- the channel name.public org.springframework.messaging.MessageChannel getOutputChannel()
MessageProducer
getOutputChannel
in interface MessageProducer
public void setErrorChannel(org.springframework.messaging.MessageChannel errorChannel)
public void setErrorChannelName(java.lang.String errorChannelName)
errorChannelName
- The error channel bean name.public org.springframework.messaging.MessageChannel getErrorChannel()
public void setSendTimeout(long sendTimeout)
sendTimeout
- the send timeout in millisecondsGenericMessagingTemplate.setSendTimeout(long)
public void setShouldTrack(boolean shouldTrack)
setShouldTrack
in interface TrackableComponent
public final void setErrorMessageStrategy(ErrorMessageStrategy errorMessageStrategy)
ErrorMessageStrategy
to use to build an error message when a exception occurs.
Default is the DefaultErrorMessageStrategy
.errorMessageStrategy
- the ErrorMessageStrategy
.protected MessagingTemplate getMessagingTemplate()
public void afterSingletonsInstantiated()
afterSingletonsInstantiated
in interface org.springframework.beans.factory.SmartInitializingSingleton
protected void onInit()
IntegrationObjectSupport
onInit
in class AbstractEndpoint
protected void doStart()
doStart
in class AbstractEndpoint
protected void doStop()
doStop
in class AbstractEndpoint
protected void sendMessage(org.springframework.messaging.Message<?> message)
protected final boolean sendErrorMessageIfNecessary(org.springframework.messaging.Message<?> message, java.lang.RuntimeException exception)
message
- the message.exception
- the exception.protected final org.springframework.messaging.support.ErrorMessage buildErrorMessage(org.springframework.messaging.Message<?> message, java.lang.RuntimeException exception)
ErrorMessageStrategy
.message
- the message.exception
- the exception.protected org.springframework.core.AttributeAccessor getErrorMessageAttributes(org.springframework.messaging.Message<?> message)
AttributeAccessor
to be used when building an error message
with the errorMessageStrategy
.message
- the message.