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.

    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.
        swapState in class Routable
        rhs - The routable to swap state with.
      • getMessage

        public Message getMessage()

        Returns the message to which this is a reply.

        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.

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

        public boolean hasErrors()

        Returns whether or not this reply contains any errors.

        True if there are errors, false otherwise.
      • hasFatalErrors

        public boolean hasFatalErrors()

        Returns whether or not this reply contains any fatal errors.

        True if it contains fatal errors.
      • getError

        public Error getError​(int i)

        Returns the error at the given position.

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

        public int getNumErrors()

        Returns the number of errors that this reply contains.

        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.

        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.

        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.

        retryDelay - The retry request.
      • getErrors

        public<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