Class MessagingTemplate
java.lang.Object
org.springframework.messaging.core.AbstractMessageSendingTemplate<D>
org.springframework.messaging.core.AbstractMessageReceivingTemplate<D>
org.springframework.messaging.core.AbstractMessagingTemplate<D>
org.springframework.messaging.core.AbstractDestinationResolvingMessagingTemplate<MessageChannel>
org.springframework.messaging.core.GenericMessagingTemplate
org.springframework.integration.core.MessagingTemplate
- All Implemented Interfaces:
Aware
,BeanFactoryAware
,DestinationResolvingMessageReceivingOperations<MessageChannel>
,DestinationResolvingMessageRequestReplyOperations<MessageChannel>
,DestinationResolvingMessageSendingOperations<MessageChannel>
,MessageReceivingOperations<MessageChannel>
,MessageRequestReplyOperations<MessageChannel>
,MessageSendingOperations<MessageChannel>
- Direct Known Subclasses:
AsyncMessagingTemplate
public class MessagingTemplate extends GenericMessagingTemplate
- Since:
- 1.0
- Author:
- Mark Fisher, Oleg Zhurakousky, Gary Russell, Artem Bilan
-
Field Summary
Fields inherited from class org.springframework.messaging.core.GenericMessagingTemplate
DEFAULT_RECEIVE_TIMEOUT_HEADER, DEFAULT_SEND_TIMEOUT_HEADER
Fields inherited from class org.springframework.messaging.core.AbstractMessageSendingTemplate
CONVERSION_HINT_HEADER, logger
-
Constructor Summary
Constructors Constructor Description MessagingTemplate()
Create a MessagingTemplate with no default channel.MessagingTemplate(MessageChannel defaultChannel)
Create a MessagingTemplate with the given default channel. -
Method Summary
Modifier and Type Method Description Message<?>
receive(MessageChannel destination, long timeout)
Object
receiveAndConvert(MessageChannel destination, long timeout)
Message<?>
sendAndReceive(MessageChannel destination, Message<?> requestMessage)
void
setBeanFactory(BeanFactory beanFactory)
Overridden to set the destination resolver to aintegrationChannelResolver
bean.void
setDefaultChannel(MessageChannel channel)
InvokessetDefaultDestination(MessageChannel)
- provided for backward compatibility.void
setThrowExceptionOnLateReply(boolean throwExceptionOnLateReply)
Methods inherited from class org.springframework.messaging.core.GenericMessagingTemplate
doReceive, doReceive, doSend, doSend, doSendAndReceive, getReceiveTimeout, getReceiveTimeoutHeader, getSendTimeout, getSendTimeoutHeader, setReceiveTimeout, setReceiveTimeoutHeader, setSendTimeout, setSendTimeoutHeader
Methods inherited from class org.springframework.messaging.core.AbstractDestinationResolvingMessagingTemplate
convertAndSend, convertAndSend, convertAndSend, convertAndSend, convertSendAndReceive, convertSendAndReceive, convertSendAndReceive, convertSendAndReceive, getDestinationResolver, receive, receiveAndConvert, resolveDestination, send, sendAndReceive, setDestinationResolver
Methods inherited from class org.springframework.messaging.core.AbstractMessagingTemplate
convertSendAndReceive, convertSendAndReceive, convertSendAndReceive, convertSendAndReceive, convertSendAndReceive, convertSendAndReceive, sendAndReceive
Methods inherited from class org.springframework.messaging.core.AbstractMessageReceivingTemplate
doConvert, receive, receive, receiveAndConvert, receiveAndConvert
Methods inherited from class org.springframework.messaging.core.AbstractMessageSendingTemplate
convertAndSend, convertAndSend, convertAndSend, convertAndSend, convertAndSend, convertAndSend, doConvert, getDefaultDestination, getMessageConverter, getRequiredDefaultDestination, processHeadersToSend, send, send, setDefaultDestination, setMessageConverter
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.messaging.core.MessageReceivingOperations
receive, receive, receiveAndConvert, receiveAndConvert
Methods inherited from interface org.springframework.messaging.core.MessageRequestReplyOperations
convertSendAndReceive, convertSendAndReceive, convertSendAndReceive, convertSendAndReceive, convertSendAndReceive, convertSendAndReceive, sendAndReceive
Methods inherited from interface org.springframework.messaging.core.MessageSendingOperations
convertAndSend, convertAndSend, convertAndSend, convertAndSend, convertAndSend, convertAndSend, send, send
-
Constructor Details
-
MessagingTemplate
public MessagingTemplate()Create a MessagingTemplate with no default channel. Note, that one may be provided by invokingsetDefaultChannel(MessageChannel)
. -
MessagingTemplate
Create a MessagingTemplate with the given default channel.- Parameters:
defaultChannel
- the defaultMessageChannel
forsend
operations
-
-
Method Details
-
setBeanFactory
Overridden to set the destination resolver to aintegrationChannelResolver
bean.- Specified by:
setBeanFactory
in interfaceBeanFactoryAware
- Overrides:
setBeanFactory
in classGenericMessagingTemplate
- Throws:
BeansException
-
setThrowExceptionOnLateReply
public void setThrowExceptionOnLateReply(boolean throwExceptionOnLateReply)- Overrides:
setThrowExceptionOnLateReply
in classGenericMessagingTemplate
-
setDefaultChannel
InvokessetDefaultDestination(MessageChannel)
- provided for backward compatibility.- Parameters:
channel
- the channel to set.
-
sendAndReceive
- Specified by:
sendAndReceive
in interfaceMessageRequestReplyOperations<MessageChannel>
- Overrides:
sendAndReceive
in classAbstractMessagingTemplate<MessageChannel>
-
receiveAndConvert
-
receive
-