Class Reply
- Direct Known Subclasses:
EmptyReply
,SimpleReply
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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Add an error to this reply.getError
(int i) Returns the error at the given position.Retrieves a set of integer error codesRetrieves a (read only) stream of the errors in this replyReturns the message to which this is a reply.int
Returns the number of errors that this reply contains.double
Returns the retry request of this reply.boolean
Returns whether or not this reply contains any errors.boolean
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
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
-
Constructor Details
-
Reply
public Reply()
-
-
Method Details
-
swapState
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
Returns the message to which this is a reply.
- Returns:
- The message.
-
setMessage
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
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
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
Retrieves a (read only) stream of the errors in this reply -
getErrorCodes
Retrieves a set of integer error codes
-