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.ObjectreceiveAndConvert(org.springframework.messaging.MessageChannel destination, long timeout)org.springframework.messaging.Message<?>sendAndReceive(org.springframework.messaging.MessageChannel destination, org.springframework.messaging.Message<?> requestMessage)voidsetBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)Overridden to set the destination resolver to aintegrationChannelResolverbean.voidsetDefaultChannel(org.springframework.messaging.MessageChannel channel)InvokessetDefaultDestination(MessageChannel)- provided for backward compatibility.voidsetThrowExceptionOnLateReply(boolean throwExceptionOnLateReply)Methods inherited from class org.springframework.messaging.core.GenericMessagingTemplate
doReceive, doReceive, doSend, doSend, doSendAndReceive, getReceiveTimeout, getReceiveTimeoutHeader, getSendTimeout, getSendTimeoutHeader, setReceiveTimeout, setReceiveTimeoutHeader, setSendTimeout, setSendTimeoutHeaderMethods inherited from class org.springframework.messaging.core.AbstractDestinationResolvingMessagingTemplate
convertAndSend, convertAndSend, convertAndSend, convertAndSend, convertSendAndReceive, convertSendAndReceive, convertSendAndReceive, convertSendAndReceive, getDestinationResolver, receive, receiveAndConvert, resolveDestination, send, sendAndReceive, setDestinationResolverMethods inherited from class org.springframework.messaging.core.AbstractMessagingTemplate
convertSendAndReceive, convertSendAndReceive, convertSendAndReceive, convertSendAndReceive, convertSendAndReceive, convertSendAndReceive, sendAndReceiveMethods inherited from class org.springframework.messaging.core.AbstractMessageReceivingTemplate
doConvert, receive, receive, receiveAndConvert, receiveAndConvertMethods inherited from class org.springframework.messaging.core.AbstractMessageSendingTemplate
convertAndSend, convertAndSend, convertAndSend, convertAndSend, convertAndSend, convertAndSend, doConvert, getDefaultDestination, getMessageConverter, getRequiredDefaultDestination, processHeadersToSend, send, send, setDefaultDestination, setMessageConverterMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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 defaultMessageChannelforsendoperations
-
-
Method Details
-
setBeanFactory
public void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory) throws org.springframework.beans.BeansExceptionOverridden to set the destination resolver to aintegrationChannelResolverbean.- Specified by:
setBeanFactoryin interfaceorg.springframework.beans.factory.BeanFactoryAware- Overrides:
setBeanFactoryin classorg.springframework.messaging.core.GenericMessagingTemplate- Throws:
org.springframework.beans.BeansException
-
setThrowExceptionOnLateReply
public void setThrowExceptionOnLateReply(boolean throwExceptionOnLateReply)- Overrides:
setThrowExceptionOnLateReplyin 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:
sendAndReceivein interfaceorg.springframework.messaging.core.MessageRequestReplyOperations<org.springframework.messaging.MessageChannel>- Overrides:
sendAndReceivein 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)
-