public abstract class MessageProducerSupport extends AbstractEndpoint implements MessageProducer, TrackableComponent, SmartInitializingSingleton, IntegrationPattern
lifecycleCondition, lifecycleLock
EXPRESSION_PARSER, logger
DEFAULT_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, isAutoStartup, isRunning, setAutoStartup, setPhase, setRole, start, stop, stop
afterPropertiesSet, 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, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getBeanName, getComponentName, getComponentType
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)
outputChannel
if provided.setOutputChannelName
in interface MessageProducer
outputChannelName
- the channel name.public MessageChannel getOutputChannel()
MessageProducer
getOutputChannel
in interface MessageProducer
public 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 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 IntegrationPatternType getIntegrationPatternType()
IntegrationPattern
getIntegrationPatternType
in interface IntegrationPattern
IntegrationPatternType
this component implements.public void afterSingletonsInstantiated()
afterSingletonsInstantiated
in interface 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(Message<?> messageArg)
protected void subscribeToPublisher(org.reactivestreams.Publisher<? extends Message<?>> publisher)
protected final boolean sendErrorMessageIfNecessary(@Nullable Message<?> message, Exception exception)
message
- the message.exception
- the exception.protected final ErrorMessage buildErrorMessage(@Nullable Message<?> message, Exception exception)
ErrorMessageStrategy
.message
- the message.exception
- the exception.protected AttributeAccessor getErrorMessageAttributes(@Nullable Message<?> message)
AttributeAccessor
to be used when building an error message
with the errorMessageStrategy
.message
- the message.