public class GenericMessagingTemplate extends AbstractDestinationResolvingMessagingTemplate<MessageChannel> implements BeanFactoryAware
MessageChannel
's
to send and receive messages from.Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DEFAULT_RECEIVE_TIMEOUT_HEADER |
static java.lang.String |
DEFAULT_SEND_TIMEOUT_HEADER |
CONVERSION_HINT_HEADER, logger
Constructor and Description |
---|
GenericMessagingTemplate() |
Modifier and Type | Method and Description |
---|---|
protected Message<?> |
doReceive(MessageChannel channel)
Actually receive a message from the given destination.
|
protected Message<?> |
doReceive(MessageChannel channel,
long timeout) |
protected void |
doSend(MessageChannel channel,
Message<?> message) |
protected void |
doSend(MessageChannel channel,
Message<?> message,
long timeout) |
protected Message<?> |
doSendAndReceive(MessageChannel channel,
Message<?> requestMessage) |
long |
getReceiveTimeout()
Return the configured receive operation timeout value.
|
java.lang.String |
getReceiveTimeoutHeader()
Return the configured receive-timeout header.
|
long |
getSendTimeout()
Return the configured default send operation timeout value.
|
java.lang.String |
getSendTimeoutHeader()
Return the configured send-timeout header.
|
void |
setBeanFactory(BeanFactory beanFactory)
Callback that supplies the owning factory to a bean instance.
|
void |
setReceiveTimeout(long receiveTimeout)
Configure the default timeout value to use for receive operations.
|
void |
setReceiveTimeoutHeader(java.lang.String receiveTimeoutHeader)
Set the name of the header used to determine the send timeout (if present).
|
void |
setSendTimeout(long sendTimeout)
Configure the default timeout value to use for send operations.
|
void |
setSendTimeoutHeader(java.lang.String sendTimeoutHeader)
Set the name of the header used to determine the send timeout (if present).
|
void |
setThrowExceptionOnLateReply(boolean throwExceptionOnLateReply)
Whether the thread sending a reply should have an exception raised if the
receiving thread isn't going to receive the reply either because it timed out,
or because it already received a reply, or because it got an exception while
sending the request message.
|
convertAndSend, convertAndSend, convertAndSend, convertAndSend, convertSendAndReceive, convertSendAndReceive, convertSendAndReceive, convertSendAndReceive, getDestinationResolver, receive, receiveAndConvert, resolveDestination, send, sendAndReceive, setDestinationResolver
convertSendAndReceive, convertSendAndReceive, convertSendAndReceive, convertSendAndReceive, convertSendAndReceive, convertSendAndReceive, sendAndReceive, sendAndReceive
doConvert, receive, receive, receiveAndConvert, receiveAndConvert
convertAndSend, convertAndSend, convertAndSend, convertAndSend, convertAndSend, convertAndSend, doConvert, getDefaultDestination, getMessageConverter, getRequiredDefaultDestination, processHeadersToSend, send, send, setDefaultDestination, setMessageConverter
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
convertAndSend, convertAndSend, convertAndSend, convertAndSend, convertAndSend, convertAndSend, send, send
receive, receive, receiveAndConvert, receiveAndConvert
convertSendAndReceive, convertSendAndReceive, convertSendAndReceive, convertSendAndReceive, convertSendAndReceive, convertSendAndReceive, sendAndReceive, sendAndReceive
public static final java.lang.String DEFAULT_SEND_TIMEOUT_HEADER
public static final java.lang.String DEFAULT_RECEIVE_TIMEOUT_HEADER
public void setSendTimeout(long sendTimeout)
sendTimeout
- the send timeout in millisecondssetSendTimeoutHeader(String)
public long getSendTimeout()
public void setReceiveTimeout(long receiveTimeout)
receiveTimeout
- the receive timeout in millisecondssetReceiveTimeoutHeader(String)
public long getReceiveTimeout()
public void setSendTimeoutHeader(java.lang.String sendTimeoutHeader)
The header is removed before sending the message to avoid propagation.
public java.lang.String getSendTimeoutHeader()
public void setReceiveTimeoutHeader(java.lang.String receiveTimeoutHeader)
public java.lang.String getReceiveTimeoutHeader()
public void setThrowExceptionOnLateReply(boolean throwExceptionOnLateReply)
The default value is false
in which case only a WARN message is logged.
If set to true
a MessageDeliveryException
is raised in addition
to the log message.
throwExceptionOnLateReply
- whether to throw an exception or notpublic void setBeanFactory(BeanFactory beanFactory) throws BeansException
BeanFactoryAware
Invoked after the population of normal bean properties
but before an initialization callback such as
InitializingBean.afterPropertiesSet()
or a custom init-method.
setBeanFactory
in interface BeanFactoryAware
beanFactory
- owning BeanFactory (never null
).
The bean can immediately call methods on the factory.BeansException
- in case of initialization errorsBeanInitializationException
protected final void doSend(MessageChannel channel, Message<?> message)
doSend
in class AbstractMessageSendingTemplate<MessageChannel>
protected final void doSend(MessageChannel channel, Message<?> message, long timeout)
@Nullable protected final Message<?> doReceive(MessageChannel channel)
AbstractMessageReceivingTemplate
doReceive
in class AbstractMessageReceivingTemplate<MessageChannel>
channel
- the target destinationnull
if the message could not
be received, for example due to a timeout@Nullable protected final Message<?> doReceive(MessageChannel channel, long timeout)
@Nullable protected final Message<?> doSendAndReceive(MessageChannel channel, Message<?> requestMessage)
doSendAndReceive
in class AbstractMessagingTemplate<MessageChannel>