Package com.yahoo.messagebus.routing
Class HopSpec
java.lang.Object
com.yahoo.messagebus.routing.HopSpec
Along with the
RoutingSpec
, RoutingTableSpec
and RouteSpec
, this holds the routing
specifications for all protocols. The only way a client can configure or alter the settings of a message bus instance
is through these classes.
This class contains the spec for a single hop.
- Author:
- Simon Thoresen Hult
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddRecipient
(String recipient) Adds the given recipient to this.addRecipients
(List<String> recipients) Adds the given recipients to this.Clears the list of recipients that the selector may choose from.boolean
boolean
Returns whether or not to ignore the result when routing through this hop.getName()
Returns the protocol-unique name of this hop.int
Returns the number of recipients that the selector can choose from.getRecipient
(int i) Returns the recipients at the given index.Returns the string selector that resolves the recipients of this hop.int
hashCode()
boolean
Returns whether or not there are any recipients that the selector can choose from.removeRecipient
(int i) Removes the recipient at the given index.setIgnoreResult
(boolean ignoreResult) Sets whether or not to ignore the result when routing through this hop.setRecipient
(int i, String recipient) Sets the recipient at the given index.void
toConfig
(StringBuilder cfg, String prefix) Appends the content of this to the given config string builder.toString()
boolean
verify
(ApplicationSpec app, RoutingTableSpec table, List<String> errors) Verifies the content of this against the given application.
-
Constructor Details
-
HopSpec
Creates a new named hop specification.- Parameters:
name
- A protocol-unique name for this hop.selector
- A string that represents the selector for this hop.
-
HopSpec
Creates a new named hop specification.- Parameters:
name
- A protocol-unique name for this hop.selector
- A string that represents the selector for this hop.verify
- Whether or not this should be verified.
-
HopSpec
Implements the copy constructor.- Parameters:
obj
- The object to copy.
-
-
Method Details
-
getName
Returns the protocol-unique name of this hop.- Returns:
- The name.
-
getSelector
Returns the string selector that resolves the recipients of this hop.- Returns:
- The selector.
-
hasRecipients
public boolean hasRecipients()Returns whether or not there are any recipients that the selector can choose from.- Returns:
- True if there is at least one recipient.
-
getNumRecipients
public int getNumRecipients()Returns the number of recipients that the selector can choose from.- Returns:
- The number of recipients.
-
getRecipient
Returns the recipients at the given index.- Parameters:
i
- The index of the recipient to return.- Returns:
- The recipient at the given index.
-
addRecipient
Adds the given recipient to this.- Parameters:
recipient
- The recipient to add.- Returns:
- This, to allow chaining.
-
addRecipients
Adds the given recipients to this.- Parameters:
recipients
- The recipients to add.- Returns:
- This, to allow chaining.
-
setRecipient
Sets the recipient at the given index.- Parameters:
i
- The index at which to set the recipient.recipient
- The recipient to set.- Returns:
- This, to allow chaining.
-
removeRecipient
Removes the recipient at the given index.- Parameters:
i
- The index of the recipient to remove.- Returns:
- The removed recipient.
-
clearRecipients
Clears the list of recipients that the selector may choose from.- Returns:
- This, to allow chaining.
-
getIgnoreResult
public boolean getIgnoreResult()Returns whether or not to ignore the result when routing through this hop.- Returns:
- True to ignore the result.
-
setIgnoreResult
Sets whether or not to ignore the result when routing through this hop.- Parameters:
ignoreResult
- Whether or not to ignore the result.- Returns:
- This, to allow chaining.
-
verify
Verifies the content of this against the given application.- Parameters:
app
- The application to verify against.table
- The routing table to verify against.errors
- The list of errors found.- Returns:
- True if no errors where found.
-
toConfig
Appends the content of this to the given config string builder.- Parameters:
cfg
- The config to add to.prefix
- The prefix to use for each add.
-
toString
-
equals
-
hashCode
public int hashCode()
-