org.springframework.messaging.core

Class GenericMessagingTemplate

    • Field Detail

      • DEFAULT_SEND_TIMEOUT_HEADER

        public static final java.lang.String DEFAULT_SEND_TIMEOUT_HEADER
        The default header key used for a send timeout.
        See Also:
        Constant Field Values
      • DEFAULT_RECEIVE_TIMEOUT_HEADER

        public static final java.lang.String DEFAULT_RECEIVE_TIMEOUT_HEADER
        The default header key used for a receive timeout.
        See Also:
        Constant Field Values
    • Constructor Detail

      • GenericMessagingTemplate

        public GenericMessagingTemplate()
    • Method Detail

      • setSendTimeout

        public void setSendTimeout(long sendTimeout)
        Configure the default timeout value to use for send operations. May be overridden for individual messages.
        Parameters:
        sendTimeout - the send timeout in milliseconds
        See Also:
        setSendTimeoutHeader(String)
      • getSendTimeout

        public long getSendTimeout()
        Return the configured default send operation timeout value.
      • setReceiveTimeout

        public void setReceiveTimeout(long receiveTimeout)
        Configure the default timeout value to use for receive operations. May be overridden for individual messages when using sendAndReceive operations.
        Parameters:
        receiveTimeout - the receive timeout in milliseconds
        See Also:
        setReceiveTimeoutHeader(String)
      • getReceiveTimeout

        public long getReceiveTimeout()
        Return the configured receive operation timeout value.
      • setSendTimeoutHeader

        public void setSendTimeoutHeader(java.lang.String sendTimeoutHeader)
        Set the name of the header used to determine the send timeout (if present). Default "sendTimeout".

        The header is removed before sending the message to avoid propagation.

        Since:
        5.0
      • getSendTimeoutHeader

        public java.lang.String getSendTimeoutHeader()
        Return the configured send-timeout header.
        Since:
        5.0
      • setReceiveTimeoutHeader

        public void setReceiveTimeoutHeader(java.lang.String receiveTimeoutHeader)
        Set the name of the header used to determine the send timeout (if present). Default "receiveTimeout". The header is removed before sending the message to avoid propagation.
        Since:
        5.0
      • getReceiveTimeoutHeader

        public java.lang.String getReceiveTimeoutHeader()
        Return the configured receive-timeout header.
        Since:
        5.0
      • setThrowExceptionOnLateReply

        public void setThrowExceptionOnLateReply(boolean throwExceptionOnLateReply)
        Whether the thread sending a reply should have an exception raised if the receiving thread isn't going to receive the reply either because it timed out, or because it already received a reply, or because it got an exception while sending the request message.

        The default value is false in which case only a WARN message is logged. If set to true a MessageDeliveryException is raised in addition to the log message.

        Parameters:
        throwExceptionOnLateReply - whether to throw an exception or not