org.springframework.messaging.core

Class AbstractDestinationResolvingMessagingTemplate<D>

    • Constructor Detail

      • AbstractDestinationResolvingMessagingTemplate

        public AbstractDestinationResolvingMessagingTemplate()
    • Method Detail

      • setDestinationResolver

        public void setDestinationResolver(@Nullable
                                           DestinationResolver<D> destinationResolver)
        Configure the DestinationResolver 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.

        Parameters:
        destinationResolver - the destination resolver to use
      • resolveDestination

        protected final D resolveDestination(java.lang.String destinationName)
      • convertAndSend

        public <T> void convertAndSend(java.lang.String destinationName,
                                       T payload,
                                       @Nullable
                                       java.util.Map<java.lang.String,java.lang.Object> headers)
        Description copied from interface: DestinationResolvingMessageSendingOperations
        Resolve the given destination name to a destination, convert the payload Object to serialized form, possibly using a MessageConverter, wrap it as a message with the given headers and send it to the resolved destination.
        Specified by:
        convertAndSend in interface DestinationResolvingMessageSendingOperations<D>
        Parameters:
        destinationName - the destination name to resolve
        payload - the Object to use as payload
        headers - headers for the message to send
      • convertAndSend

        public <T> void convertAndSend(java.lang.String destinationName,
                                       T payload,
                                       @Nullable
                                       java.util.Map<java.lang.String,java.lang.Object> headers,
                                       @Nullable
                                       MessagePostProcessor postProcessor)
        Description copied from interface: DestinationResolvingMessageSendingOperations
        Resolve the given destination name to a destination, convert the payload Object to serialized form, possibly using a MessageConverter, wrap it as a message with the given headers, apply the given post processor, and send the resulting message to the resolved destination.
        Specified by:
        convertAndSend in interface DestinationResolvingMessageSendingOperations<D>
        Parameters:
        destinationName - the destination name to resolve
        payload - the Object to use as payload
        headers - headers for the message to send
        postProcessor - the post processor to apply to the message
      • convertSendAndReceive

        @Nullable
        public <T> T convertSendAndReceive(java.lang.String destinationName,
                                                     java.lang.Object request,
                                                     java.lang.Class<T> targetClass)
        Description copied from interface: DestinationResolvingMessageRequestReplyOperations
        Resolve the given destination name, convert the payload request Object to serialized form, possibly using a MessageConverter, wrap it as a message and send it to the resolved destination, receive a reply and convert its body to the specified target class.
        Specified by:
        convertSendAndReceive in interface DestinationResolvingMessageRequestReplyOperations<D>
        Parameters:
        destinationName - the name of the target destination
        request - the payload for the request message to send
        targetClass - the target class to convert the payload of the reply to
        Returns:
        the converted payload of the reply message, possibly null if the message could not be received, for example due to a timeout
      • convertSendAndReceive

        @Nullable
        public <T> T convertSendAndReceive(java.lang.String destinationName,
                                                     java.lang.Object request,
                                                     @Nullable
                                                     java.util.Map<java.lang.String,java.lang.Object> headers,
                                                     java.lang.Class<T> targetClass)
        Description copied from interface: DestinationResolvingMessageRequestReplyOperations
        Resolve the given destination name, convert the payload request Object to serialized form, possibly using a MessageConverter, 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.
        Specified by:
        convertSendAndReceive in interface DestinationResolvingMessageRequestReplyOperations<D>
        Parameters:
        destinationName - the name of the target destination
        request - the payload for the request message to send
        headers - the headers for the request message to send
        targetClass - the target class to convert the payload of the reply to
        Returns:
        the converted payload of the reply message, possibly null if the message could not be received, for example due to a timeout
      • convertSendAndReceive

        @Nullable
        public <T> T convertSendAndReceive(java.lang.String destinationName,
                                                     java.lang.Object request,
                                                     java.lang.Class<T> targetClass,
                                                     @Nullable
                                                     MessagePostProcessor postProcessor)
        Description copied from interface: DestinationResolvingMessageRequestReplyOperations
        Resolve the given destination name, convert the payload request Object to serialized form, possibly using a MessageConverter, 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.
        Specified by:
        convertSendAndReceive in interface DestinationResolvingMessageRequestReplyOperations<D>
        Parameters:
        destinationName - the name of the target destination
        request - the payload for the request message to send
        targetClass - the target class to convert the payload of the reply to
        postProcessor - post process for the request message
        Returns:
        the converted payload of the reply message, possibly null if the message could not be received, for example due to a timeout
      • convertSendAndReceive

        @Nullable
        public <T> T convertSendAndReceive(java.lang.String destinationName,
                                                     java.lang.Object request,
                                                     @Nullable
                                                     java.util.Map<java.lang.String,java.lang.Object> headers,
                                                     java.lang.Class<T> targetClass,
                                                     @Nullable
                                                     MessagePostProcessor postProcessor)
        Description copied from interface: DestinationResolvingMessageRequestReplyOperations
        Resolve the given destination name, convert the payload request Object to serialized form, possibly using a MessageConverter, 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.
        Specified by:
        convertSendAndReceive in interface DestinationResolvingMessageRequestReplyOperations<D>
        Parameters:
        destinationName - the name of the target destination
        request - the payload for the request message to send
        headers - the headers for the request message to send
        targetClass - the target class to convert the payload of the reply to
        postProcessor - post process for the request message
        Returns:
        the converted payload of the reply message, possibly null if the message could not be received, for example due to a timeout