类 AbstractDestinationResolvingMessagingTemplate<D>
- 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<D>
- 所有已实现的接口:
DestinationResolvingMessageReceivingOperations<D>
,DestinationResolvingMessageRequestReplyOperations<D>
,DestinationResolvingMessageSendingOperations<D>
,MessageReceivingOperations<D>
,MessageRequestReplyOperations<D>
,MessageSendingOperations<D>
- 直接已知子类:
GenericMessagingTemplate
public abstract class AbstractDestinationResolvingMessagingTemplate<D> extends AbstractMessagingTemplate<D> implements DestinationResolvingMessageSendingOperations<D>, DestinationResolvingMessageReceivingOperations<D>, DestinationResolvingMessageRequestReplyOperations<D>
An extension ofAbstractMessagingTemplate
that adds operations for sending messages to a resolvable destination name as defined by the following interfaces:- 从以下版本开始:
- 4.0
- 作者:
- Mark Fisher, Rossen Stoyanchev
字段概要
从类继承的字段 org.springframework.messaging.core.AbstractMessageSendingTemplate
CONVERSION_HINT_HEADER, logger
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 <T> void
convertAndSend(String destinationName, T payload)
Resolve the given destination name to a destination, convert the payload Object to serialized form, possibly using aMessageConverter
, wrap it as a message and send it to the resolved destination.<T> void
convertAndSend(String destinationName, T payload, Map<String,Object> headers)
Resolve the given destination name to a destination, convert the payload Object to serialized form, possibly using aMessageConverter
, wrap it as a message with the given headers and send it to the resolved destination.<T> void
convertAndSend(String destinationName, T payload, Map<String,Object> headers, MessagePostProcessor postProcessor)
Resolve the given destination name to a destination, convert the payload Object to serialized form, possibly using aMessageConverter
, wrap it as a message with the given headers, apply the given post processor, and send the resulting message to the resolved destination.<T> void
convertAndSend(String destinationName, T payload, MessagePostProcessor postProcessor)
Resolve the given destination name to a destination, convert the payload Object to serialized form, possibly using aMessageConverter
, wrap it as a message, apply the given post processor, and send the resulting message to the resolved destination.<T> T
convertSendAndReceive(String destinationName, Object request, Class<T> targetClass)
Resolve the given destination name, convert the payload request Object to serialized form, possibly using aMessageConverter
, wrap it as a message and send it to the resolved destination, receive a reply and convert its body to the specified target class.<T> T
convertSendAndReceive(String destinationName, Object request, Class<T> targetClass, MessagePostProcessor postProcessor)
Resolve the given destination name, convert the payload request Object to serialized form, possibly using aMessageConverter
, wrap it as a message, apply the given post process, and send the resulting message to the resolved destination, then receive a reply and convert its body to the specified target class.<T> T
convertSendAndReceive(String destinationName, Object request, Map<String,Object> headers, Class<T> targetClass)
Resolve the given destination name, convert the payload request Object to serialized form, possibly using aMessageConverter
, wrap it as a message with the given headers and send it to the resolved destination, receive a reply and convert its body to the specified target class.<T> T
convertSendAndReceive(String destinationName, Object request, Map<String,Object> headers, Class<T> targetClass, MessagePostProcessor postProcessor)
Resolve the given destination name, convert the payload request Object to serialized form, possibly using aMessageConverter
, wrap it as a message with the given headers, apply the given post process, and send the resulting message to the resolved destination, then receive a reply and convert its body to the specified target class.DestinationResolver<D>
getDestinationResolver()
Return the configured destination resolver.Message<?>
receive(String destinationName)
Resolve the given destination name and receive a message from it.<T> T
receiveAndConvert(String destinationName, Class<T> targetClass)
Resolve the given destination name, receive a message from it, convert the payload to the specified target type.protected D
resolveDestination(String destinationName)
void
send(String destinationName, Message<?> message)
Resolve the given destination name to a destination and send a message to it.Message<?>
sendAndReceive(String destinationName, Message<?> requestMessage)
Resolve the given destination name to a destination and send the given message, receive a reply and return it.void
setDestinationResolver(DestinationResolver<D> destinationResolver)
Configure theDestinationResolver
to use to resolve String destination names into actual destinations of type<D>
.从类继承的方法 org.springframework.messaging.core.AbstractMessagingTemplate
convertSendAndReceive, convertSendAndReceive, convertSendAndReceive, convertSendAndReceive, convertSendAndReceive, convertSendAndReceive, doSendAndReceive, sendAndReceive, sendAndReceive
从类继承的方法 org.springframework.messaging.core.AbstractMessageReceivingTemplate
doConvert, doReceive, receive, receive, receiveAndConvert, receiveAndConvert
从类继承的方法 org.springframework.messaging.core.AbstractMessageSendingTemplate
convertAndSend, convertAndSend, convertAndSend, convertAndSend, convertAndSend, convertAndSend, doConvert, doSend, getDefaultDestination, getMessageConverter, getRequiredDefaultDestination, processHeadersToSend, send, send, setDefaultDestination, setMessageConverter
从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
从接口继承的方法 org.springframework.messaging.core.MessageReceivingOperations
receive, receive, receiveAndConvert, receiveAndConvert
从接口继承的方法 org.springframework.messaging.core.MessageRequestReplyOperations
convertSendAndReceive, convertSendAndReceive, convertSendAndReceive, convertSendAndReceive, convertSendAndReceive, convertSendAndReceive, sendAndReceive, sendAndReceive
从接口继承的方法 org.springframework.messaging.core.MessageSendingOperations
convertAndSend, convertAndSend, convertAndSend, convertAndSend, convertAndSend, convertAndSend, send, send
构造器详细资料
AbstractDestinationResolvingMessagingTemplate
public AbstractDestinationResolvingMessagingTemplate()
方法详细资料
setDestinationResolver
public void setDestinationResolver(DestinationResolver<D> destinationResolver)
Configure theDestinationResolver
to use to resolve String destination names into actual destinations of type<D>
.This field does not have a default setting. If not configured, methods that require resolving a destination name will raise an
IllegalArgumentException
.- 参数:
destinationResolver
- the destination resolver to use
getDestinationResolver
public DestinationResolver<D> getDestinationResolver()
Return the configured destination resolver.
send
public void send(String destinationName, Message<?> message)
Resolve the given destination name to a destination and send a message to it.- 指定者:
send
在接口中DestinationResolvingMessageSendingOperations<D>
- 参数:
destinationName
- the destination name to resolvemessage
- the message to send
resolveDestination
protected final D resolveDestination(String destinationName)
convertAndSend
public <T> void convertAndSend(String destinationName, T payload)
Resolve the given destination name to a destination, convert the payload Object to serialized form, possibly using aMessageConverter
, wrap it as a message and send it to the resolved destination.- 指定者:
convertAndSend
在接口中DestinationResolvingMessageSendingOperations<D>
- 参数:
destinationName
- the destination name to resolvepayload
- the Object to use as payload
convertAndSend
public <T> void convertAndSend(String destinationName, T payload, Map<String,Object> headers)
Resolve the given destination name to a destination, convert the payload Object to serialized form, possibly using aMessageConverter
, wrap it as a message with the given headers and send it to the resolved destination.- 指定者:
convertAndSend
在接口中DestinationResolvingMessageSendingOperations<D>
- 参数:
destinationName
- the destination name to resolvepayload
- the Object to use as payloadheaders
- headers for the message to send
convertAndSend
public <T> void convertAndSend(String destinationName, T payload, MessagePostProcessor postProcessor)
Resolve the given destination name to a destination, convert the payload Object to serialized form, possibly using aMessageConverter
, wrap it as a message, apply the given post processor, and send the resulting message to the resolved destination.- 指定者:
convertAndSend
在接口中DestinationResolvingMessageSendingOperations<D>
- 参数:
destinationName
- the destination name to resolvepayload
- the Object to use as payloadpostProcessor
- the post processor to apply to the message
convertAndSend
public <T> void convertAndSend(String destinationName, T payload, Map<String,Object> headers, MessagePostProcessor postProcessor)
Resolve the given destination name to a destination, convert the payload Object to serialized form, possibly using aMessageConverter
, wrap it as a message with the given headers, apply the given post processor, and send the resulting message to the resolved destination.- 指定者:
convertAndSend
在接口中DestinationResolvingMessageSendingOperations<D>
- 参数:
destinationName
- the destination name to resolvepayload
- the Object to use as payloadheaders
- headers for the message to sendpostProcessor
- the post processor to apply to the message
receive
public Message<?> receive(String destinationName)
Resolve the given destination name and receive a message from it.- 指定者:
receive
在接口中DestinationResolvingMessageReceivingOperations<D>
- 参数:
destinationName
- the destination name to resolve
receiveAndConvert
public <T> T receiveAndConvert(String destinationName, Class<T> targetClass)
Resolve the given destination name, receive a message from it, convert the payload to the specified target type.- 指定者:
receiveAndConvert
在接口中DestinationResolvingMessageReceivingOperations<D>
- 参数:
destinationName
- the destination name to resolvetargetClass
- the target class for the converted payload
sendAndReceive
public Message<?> sendAndReceive(String destinationName, Message<?> requestMessage)
Resolve the given destination name to a destination and send the given message, receive a reply and return it.- 指定者:
sendAndReceive
在接口中DestinationResolvingMessageRequestReplyOperations<D>
- 参数:
destinationName
- the name of the target destinationrequestMessage
- the mesage to send- 返回:
- the received message, possibly
null
if the message could not be received, for example due to a timeout
convertSendAndReceive
public <T> T convertSendAndReceive(String destinationName, Object request, Class<T> targetClass)
Resolve the given destination name, convert the payload request Object to serialized form, possibly using aMessageConverter
, wrap it as a message and send it to the resolved destination, receive a reply and convert its body to the specified target class.- 指定者:
convertSendAndReceive
在接口中DestinationResolvingMessageRequestReplyOperations<D>
- 参数:
destinationName
- the name of the target destinationrequest
- the payload for the request message to sendtargetClass
- the target class to convert the payload of the reply to- 返回:
- the converted payload of the reply message, possibly
null
if the message could not be received, for example due to a timeout
convertSendAndReceive
public <T> T convertSendAndReceive(String destinationName, Object request, Map<String,Object> headers, Class<T> targetClass)
Resolve the given destination name, convert the payload request Object to serialized form, possibly using aMessageConverter
, wrap it as a message with the given headers and send it to the resolved destination, receive a reply and convert its body to the specified target class.- 指定者:
convertSendAndReceive
在接口中DestinationResolvingMessageRequestReplyOperations<D>
- 参数:
destinationName
- the name of the target destinationrequest
- the payload for the request message to sendheaders
- the headers for the request message to sendtargetClass
- the target class to convert the payload of the reply to- 返回:
- the converted payload of the reply message, possibly
null
if the message could not be received, for example due to a timeout
convertSendAndReceive
public <T> T convertSendAndReceive(String destinationName, Object request, Class<T> targetClass, MessagePostProcessor postProcessor)
Resolve the given destination name, convert the payload request Object to serialized form, possibly using aMessageConverter
, wrap it as a message, apply the given post process, and send the resulting message to the resolved destination, then receive a reply and convert its body to the specified target class.- 指定者:
convertSendAndReceive
在接口中DestinationResolvingMessageRequestReplyOperations<D>
- 参数:
destinationName
- the name of the target destinationrequest
- the payload for the request message to sendtargetClass
- the target class to convert the payload of the reply topostProcessor
- post process for the request message- 返回:
- the converted payload of the reply message, possibly
null
if the message could not be received, for example due to a timeout
convertSendAndReceive
public <T> T convertSendAndReceive(String destinationName, Object request, Map<String,Object> headers, Class<T> targetClass, MessagePostProcessor postProcessor)
Resolve the given destination name, convert the payload request Object to serialized form, possibly using aMessageConverter
, wrap it as a message with the given headers, apply the given post process, and send the resulting message to the resolved destination, then receive a reply and convert its body to the specified target class.- 指定者:
convertSendAndReceive
在接口中DestinationResolvingMessageRequestReplyOperations<D>
- 参数:
destinationName
- the name of the target destinationrequest
- the payload for the request message to sendheaders
- the headers for the request message to sendtargetClass
- the target class to convert the payload of the reply topostProcessor
- post process for the request message- 返回:
- the converted payload of the reply message, possibly
null
if the message could not be received, for example due to a timeout