org.springframework.messaging.core

Class AbstractMessagingTemplate<D>

    • Constructor Detail

      • AbstractMessagingTemplate

        public AbstractMessagingTemplate()
    • Method Detail

      • sendAndReceive

        @Nullable
        public Message<?> sendAndReceive(D destination,
                                                   Message<?> requestMessage)
        Description copied from interface: MessageRequestReplyOperations
        Send a request message and receive the reply from the given destination.
        Specified by:
        sendAndReceive in interface MessageRequestReplyOperations<D>
        Parameters:
        destination - the target destination
        requestMessage - the message to send
        Returns:
        the reply, possibly null if the message could not be received, for example due to a timeout
      • doSendAndReceive

        @Nullable
        protected abstract Message<?> doSendAndReceive(D destination,
                                                                 Message<?> requestMessage)
      • convertSendAndReceive

        @Nullable
        public <T> T convertSendAndReceive(java.lang.Object request,
                                                     java.lang.Class<T> targetClass)
        Description copied from interface: MessageRequestReplyOperations
        Convert the given request Object to serialized form, possibly using a MessageConverter, send it as a Message to a default destination, receive the reply and convert its body of the specified target class.
        Specified by:
        convertSendAndReceive in interface MessageRequestReplyOperations<D>
        Parameters:
        request - payload for the request message to send
        targetClass - the target type to convert the payload of the reply to
        Returns:
        the 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(D destination,
                                                     java.lang.Object request,
                                                     java.lang.Class<T> targetClass)
        Description copied from interface: MessageRequestReplyOperations
        Convert the given request Object to serialized form, possibly using a MessageConverter, send it as a Message to the given destination, receive the reply and convert its body of the specified target class.
        Specified by:
        convertSendAndReceive in interface MessageRequestReplyOperations<D>
        Parameters:
        destination - the target destination
        request - payload for the request message to send
        targetClass - the target type to convert the payload of the reply to
        Returns:
        the 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(D destination,
                                                     java.lang.Object request,
                                                     @Nullable
                                                     java.util.Map<java.lang.String,java.lang.Object> headers,
                                                     java.lang.Class<T> targetClass)
        Description copied from interface: MessageRequestReplyOperations
        Convert the given request Object to serialized form, possibly using a MessageConverter, send it as a Message with the given headers, to the specified destination, receive the reply and convert its body of the specified target class.
        Specified by:
        convertSendAndReceive in interface MessageRequestReplyOperations<D>
        Parameters:
        destination - the target destination
        request - payload for the request message to send
        headers - headers for the request message to send
        targetClass - the target type to convert the payload of the reply to
        Returns:
        the 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.Object request,
                                                     java.lang.Class<T> targetClass,
                                                     @Nullable
                                                     MessagePostProcessor postProcessor)
        Description copied from interface: MessageRequestReplyOperations
        Convert the given request Object to serialized form, possibly using a MessageConverter, apply the given post processor and send the resulting Message to a default destination, receive the reply and convert its body of the given target class.
        Specified by:
        convertSendAndReceive in interface MessageRequestReplyOperations<D>
        Parameters:
        request - payload for the request message to send
        targetClass - the target type to convert the payload of the reply to
        postProcessor - post process to apply to the request message
        Returns:
        the 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(D destination,
                                                     java.lang.Object request,
                                                     java.lang.Class<T> targetClass,
                                                     @Nullable
                                                     MessagePostProcessor postProcessor)
        Description copied from interface: MessageRequestReplyOperations
        Convert the given request Object to serialized form, possibly using a MessageConverter, apply the given post processor and send the resulting Message to the given destination, receive the reply and convert its body of the given target class.
        Specified by:
        convertSendAndReceive in interface MessageRequestReplyOperations<D>
        Parameters:
        destination - the target destination
        request - payload for the request message to send
        targetClass - the target type to convert the payload of the reply to
        postProcessor - post process to apply to the request message
        Returns:
        the 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(D destination,
                                                     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: MessageRequestReplyOperations
        Convert the given request 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 specified destination, receive the reply and convert its body of the given target class.
        Specified by:
        convertSendAndReceive in interface MessageRequestReplyOperations<D>
        Parameters:
        destination - the target destination
        request - payload for the request message to send
        targetClass - the target type to convert the payload of the reply to
        postProcessor - post process to apply to the request message
        Returns:
        the payload of the reply message, possibly null if the message could not be received, for example due to a timeout