RiakCluster.Builder Class
A Builder for constructing RiakCluster instances.
Rather than having to manually construct the options and instantiating a RiakCluster directly, this builder may be used.
var newCluster = new RiakCluster.Builder().withRiakNodes([node1, node2]).build();
Constructor
RiakCluster.Builder
()
Item Index
Methods
withExecutionAttempts
-
numAttempts
Set the number of times a command will be attempted. In the case of a command failing for any reason, it will be retried on a different node.
Parameters:
-
numAttempts
Number- the number of times to attempt a command (default: 3)
Returns:
withNodeManager
-
nodeManager
Set the NodeManager for this cluster.
If not provided the RoundRobinNodeManager is used.
Parameters:
-
nodeManager
NodeManagerthe node manager used to select nodes.
withQueueCommands
-
[maxDepth=unlimited]
-
[submitInterval=500]
Set whether to queue commands or not if no RiakNodes are available.
If all nodes are down (health checking) or maxConnections are in use on all nodes, the default behavior is to fail commands when submitted.
Setting this option causes the the RiakCluster to queue additional commands (FIFO) then send them when nodes/connections become available.
If maxDepth is supplied the queue is bounded and additional commands attempting to be queued will be failed. The default is an unbounded queue.
Parameters:
-
[maxDepth=unlimited]
Number optionalthe maximum number of commands to queue. Default is unlimited.
-
[submitInterval=500]
Number optionalThe duration in milliseconds between queue submission attempts. Default is 500.
withRiakNodes
-
nodes
The RiakNodes to use.
Parameters:
-
nodes
RiakNode[]array of (unstarted) RiakNode instances.