Class Reply

  • Direct Known Subclasses:
    EmptyReply, SimpleReply

    public abstract class Reply
    extends Routable

    A reply is a response to a message that has been sent throught the messagebus. No reply will ever exist without a corresponding message. There are no error-replies defined, as errors can instead piggyback any reply by the errors member variable.

    Author:
    Simon Thoresen Hult
    • Constructor Detail

      • Reply

        public Reply()
    • Method Detail

      • swapState

        public void swapState​(Routable rhs)
        Description copied from class: Routable
        Swaps the state that makes this routable unique to another routable. The state is what identifies a routable for message bus, so only one message can ever have the same state. This function must be called explicitly when cloning and copying messages.
        Overrides:
        swapState in class Routable
        Parameters:
        rhs - The routable to swap state with.
      • getMessage

        public Message getMessage()

        Returns the message to which this is a reply.

        Returns:
        The message.
      • setMessage

        public void setMessage​(Message msg)

        Sets the message to which this is a reply. Although it might seem very bogus to allow such an accessor, it is necessary since we allow an empty constructor.

        Parameters:
        msg - The message to which this is a reply.
      • hasErrors

        public boolean hasErrors()

        Returns whether or not this reply contains any errors.

        Returns:
        True if there are errors, false otherwise.
      • hasFatalErrors

        public boolean hasFatalErrors()

        Returns whether or not this reply contains any fatal errors.

        Returns:
        True if it contains fatal errors.
      • getError

        public Error getError​(int i)

        Returns the error at the given position.

        Parameters:
        i - The index of the error to return.
        Returns:
        The error at the given index.
      • getNumErrors

        public int getNumErrors()

        Returns the number of errors that this reply contains.

        Returns:
        The number of replies.
      • addError

        public void addError​(Error error)

        Add an error to this reply. This method will also trace the error as long as there is any tracing enabled.

        Parameters:
        error - The error object to add.
      • getRetryDelay

        public double getRetryDelay()

        Returns the retry request of this reply. This can be set using setRetryDelay(double) and is an instruction to the resender logic of message bus on how to perform the retry. If this value is anything other than a negative number, it instructs the resender to disregard all configured resending attributes and instead act according to this value.

        Returns:
        The retry request.
      • setRetryDelay

        public void setRetryDelay​(double retryDelay)

        Sets the retry delay request of this reply. If this is a negative number, it will use the defaults configured in the source session.

        Parameters:
        retryDelay - The retry request.
      • getErrors

        public java.util.stream.Stream<Error> getErrors()
        Retrieves a (read only) stream of the errors in this reply
      • getErrorCodes

        public java.util.Set<java.lang.Integer> getErrorCodes()
        Retrieves a set of integer error codes