Class Reply
- java.lang.Object
-
- com.yahoo.messagebus.Routable
-
- com.yahoo.messagebus.Reply
-
- Direct Known Subclasses:
EmptyReply
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 Summary
Constructors Constructor Description Reply()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addError(Error error)
Add an error to this reply.Error
getError(int i)
Returns the error at the given position.java.util.Set<java.lang.Integer>
getErrorCodes()
Retrieves a set of integer error codesjava.util.stream.Stream<Error>
getErrors()
Retrieves a (read only) stream of the errors in this replyMessage
getMessage()
Returns the message to which this is a reply.int
getNumErrors()
Returns the number of errors that this reply contains.double
getRetryDelay()
Returns the retry request of this reply.boolean
hasErrors()
Returns whether or not this reply contains any errors.boolean
hasFatalErrors()
Returns whether or not this reply contains any fatal errors.void
setMessage(Message msg)
Sets the message to which this is a reply.void
setRetryDelay(double retryDelay)
Sets the retry delay request of this reply.void
swapState(Routable rhs)
Swaps the state that makes this routable unique to another routable.-
Methods inherited from class com.yahoo.messagebus.Routable
discard, getCallStack, getContext, getProtocol, getTrace, getType, popHandler, pushHandler, setContext
-
-
-
-
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.
-
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
-
-