org.springframework.messaging.core

Class AbstractMessageReceivingTemplate<D>

    • Constructor Detail

      • AbstractMessageReceivingTemplate

        public AbstractMessageReceivingTemplate()
    • Method Detail

      • receive

        @Nullable
        public Message<?> receive(D destination)
        Description copied from interface: MessageReceivingOperations
        Receive a message from the given destination.
        Specified by:
        receive in interface MessageReceivingOperations<D>
        Parameters:
        destination - the target destination
        Returns:
        the received message, possibly null if the message could not be received, for example due to a timeout
      • doReceive

        @Nullable
        protected abstract Message<?> doReceive(D destination)
        Actually receive a message from the given destination.
        Parameters:
        destination - the target destination
        Returns:
        the received message, possibly null if the message could not be received, for example due to a timeout
      • receiveAndConvert

        @Nullable
        public <T> T receiveAndConvert(java.lang.Class<T> targetClass)
        Description copied from interface: MessageReceivingOperations
        Receive a message from a default destination and convert its payload to the specified target class.
        Specified by:
        receiveAndConvert in interface MessageReceivingOperations<D>
        Parameters:
        targetClass - the target class to convert the payload to
        Returns:
        the converted payload of the reply message, possibly null if the message could not be received, for example due to a timeout
      • receiveAndConvert

        @Nullable
        public <T> T receiveAndConvert(D destination,
                                                 java.lang.Class<T> targetClass)
        Description copied from interface: MessageReceivingOperations
        Receive a message from the given destination and convert its payload to the specified target class.
        Specified by:
        receiveAndConvert in interface MessageReceivingOperations<D>
        Parameters:
        destination - the target destination
        targetClass - the target class to convert the payload to
        Returns:
        the converted payload of the reply message, possibly null if the message could not be received, for example due to a timeout
      • doConvert

        @Nullable
        protected <T> T doConvert(Message<?> message,
                                            java.lang.Class<T> targetClass)
        Convert from the given message to the given target class.
        Parameters:
        message - the message to convert
        targetClass - the target class to convert the payload to
        Returns:
        the converted payload of the reply message (never null)