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<org.springframework.messaging.MessageChannel>
org.springframework.messaging.core.GenericMessagingTemplate
org.springframework.integration.core.MessagingTemplate
- All Implemented Interfaces:
org.springframework.beans.factory.Aware
,org.springframework.beans.factory.BeanFactoryAware
,org.springframework.messaging.core.DestinationResolvingMessageReceivingOperations<org.springframework.messaging.MessageChannel>
,org.springframework.messaging.core.DestinationResolvingMessageRequestReplyOperations<org.springframework.messaging.MessageChannel>
,org.springframework.messaging.core.DestinationResolvingMessageSendingOperations<org.springframework.messaging.MessageChannel>
,org.springframework.messaging.core.MessageReceivingOperations<org.springframework.messaging.MessageChannel>
,org.springframework.messaging.core.MessageRequestReplyOperations<org.springframework.messaging.MessageChannel>
,org.springframework.messaging.core.MessageSendingOperations<org.springframework.messaging.MessageChannel>
- Direct Known Subclasses:
AsyncMessagingTemplate
public class MessagingTemplate
extends org.springframework.messaging.core.GenericMessagingTemplate
- Since:
- 1.0
-
Field Summary
-
Constructor Summary
Constructors Constructor Description MessagingTemplate()
Create a MessagingTemplate with no default channel.MessagingTemplate(org.springframework.messaging.MessageChannel defaultChannel)
Create a MessagingTemplate with the given default channel. -
Method Summary
Modifier and Type Method Description org.springframework.messaging.Message<?>
receive(org.springframework.messaging.MessageChannel destination, long timeout)
java.lang.Object
receiveAndConvert(org.springframework.messaging.MessageChannel destination, long timeout)
org.springframework.messaging.Message<?>
sendAndReceive(org.springframework.messaging.MessageChannel destination, org.springframework.messaging.Message<?> requestMessage)
void
setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
Overridden to set the destination resolver to aintegrationChannelResolver
bean.void
setDefaultChannel(org.springframework.messaging.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
-
Constructor Details
-
MessagingTemplate
public MessagingTemplate()Create a MessagingTemplate with no default channel. Note, that one may be provided by invokingsetDefaultChannel(MessageChannel)
. -
MessagingTemplate
public MessagingTemplate(org.springframework.messaging.MessageChannel defaultChannel)Create a MessagingTemplate with the given default channel.- Parameters:
defaultChannel
- the defaultMessageChannel
forsend
operations
-
-
Method Details
-
setBeanFactory
public void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory) throws org.springframework.beans.BeansExceptionOverridden to set the destination resolver to aintegrationChannelResolver
bean.- Specified by:
setBeanFactory
in interfaceorg.springframework.beans.factory.BeanFactoryAware
- Overrides:
setBeanFactory
in classorg.springframework.messaging.core.GenericMessagingTemplate
- Throws:
org.springframework.beans.BeansException
-
setThrowExceptionOnLateReply
public void setThrowExceptionOnLateReply(boolean throwExceptionOnLateReply)- Overrides:
setThrowExceptionOnLateReply
in classorg.springframework.messaging.core.GenericMessagingTemplate
-
setDefaultChannel
public void setDefaultChannel(org.springframework.messaging.MessageChannel channel)InvokessetDefaultDestination(MessageChannel)
- provided for backward compatibility.- Parameters:
channel
- the channel to set.
-
sendAndReceive
public org.springframework.messaging.Message<?> sendAndReceive(org.springframework.messaging.MessageChannel destination, org.springframework.messaging.Message<?> requestMessage)- Specified by:
sendAndReceive
in interfaceorg.springframework.messaging.core.MessageRequestReplyOperations<org.springframework.messaging.MessageChannel>
- Overrides:
sendAndReceive
in classorg.springframework.messaging.core.AbstractMessagingTemplate<org.springframework.messaging.MessageChannel>
-
receiveAndConvert
public java.lang.Object receiveAndConvert(org.springframework.messaging.MessageChannel destination, long timeout) -
receive
public org.springframework.messaging.Message<?> receive(org.springframework.messaging.MessageChannel destination, long timeout)
-