public abstract class MessageProducerSupport extends AbstractEndpoint implements MessageProducer, TrackableComponent, SmartInitializingSingleton, IntegrationPattern
lifecycleCondition, lifecycleLockEXPRESSION_PARSER, loggerDEFAULT_PHASE| Modifier | Constructor and Description |
|---|---|
protected |
MessageProducerSupport() |
| Modifier and Type | Method and Description |
|---|---|
void |
afterSingletonsInstantiated() |
protected ErrorMessage |
buildErrorMessage(Message<?> message,
Exception exception)
Build an error message for the exception and message using the configured
ErrorMessageStrategy. |
protected void |
doStart()
Take no action by default.
|
protected void |
doStop()
Take no action by default.
|
MessageChannel |
getErrorChannel()
Return the error channel (if provided) to which error messages will
be routed.
|
protected AttributeAccessor |
getErrorMessageAttributes(Message<?> message)
Populate an
AttributeAccessor to be used when building an error message
with the errorMessageStrategy. |
IntegrationPatternType |
getIntegrationPatternType()
Return a pattern type this component implements.
|
protected MessagingTemplate |
getMessagingTemplate() |
MessageChannel |
getOutputChannel()
Return the the output channel.
|
protected void |
onInit()
Subclasses may implement this for initialization logic.
|
protected boolean |
sendErrorMessageIfNecessary(Message<?> message,
Exception exception)
Send an error message based on the exception and message.
|
protected void |
sendMessage(Message<?> messageArg) |
void |
setErrorChannel(MessageChannel errorChannel) |
void |
setErrorChannelName(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(MessageChannel outputChannel)
Specify the
MessageChannel to which produced Messages should be sent. |
void |
setOutputChannelName(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) |
protected void |
subscribeToPublisher(org.reactivestreams.Publisher<? extends Message<?>> publisher) |
destroy, doStop, getPhase, getRole, isActive, isAutoStartup, isRunning, setAutoStartup, setPhase, setRole, start, stop, stopafterPropertiesSet, extractTypeIfPossible, generateId, getApplicationContext, getApplicationContextId, getBeanDescription, getBeanFactory, getBeanName, getChannelResolver, getComponentName, getComponentType, getConversionService, getExpression, getIntegrationProperties, getIntegrationProperty, getMessageBuilderFactory, getTaskScheduler, isInitialized, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentName, setConversionService, setMessageBuilderFactory, setPrimaryExpression, setTaskScheduler, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetBeanName, getComponentName, getComponentTypepublic void setOutputChannel(MessageChannel outputChannel)
MessageProducerMessageChannel to which produced Messages should be sent.setOutputChannel in interface MessageProduceroutputChannel - The output channel.public void setOutputChannelName(String outputChannelName)
outputChannel if provided.setOutputChannelName in interface MessageProduceroutputChannelName - the channel name.public MessageChannel getOutputChannel()
MessageProducergetOutputChannel in interface MessageProducerpublic void setErrorChannel(MessageChannel errorChannel)
public void setErrorChannelName(String errorChannelName)
errorChannelName - The error channel bean name.@Nullable public MessageChannel getErrorChannel()
public void setSendTimeout(long sendTimeout)
sendTimeout - the send timeout in millisecondsGenericMessagingTemplate.setSendTimeout(long)public void setShouldTrack(boolean shouldTrack)
setShouldTrack in interface TrackableComponentpublic 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 IntegrationPatternType getIntegrationPatternType()
IntegrationPatterngetIntegrationPatternType in interface IntegrationPatternIntegrationPatternType this component implements.public void afterSingletonsInstantiated()
afterSingletonsInstantiated in interface SmartInitializingSingletonprotected void onInit()
IntegrationObjectSupportonInit in class AbstractEndpointprotected void doStart()
doStart in class AbstractEndpointprotected void doStop()
doStop in class AbstractEndpointprotected void sendMessage(Message<?> messageArg)
protected void subscribeToPublisher(org.reactivestreams.Publisher<? extends Message<?>> publisher)
protected final boolean sendErrorMessageIfNecessary(Message<?> message, Exception exception)
message - the message.exception - the exception.protected final ErrorMessage buildErrorMessage(Message<?> message, Exception exception)
ErrorMessageStrategy.message - the message.exception - the exception.protected AttributeAccessor getErrorMessageAttributes(Message<?> message)
AttributeAccessor to be used when building an error message
with the errorMessageStrategy.message - the message.