Top Description Methods
io.vertx.core.spi.cluster

public Interface ClusterManager

extends VertxServiceProvider
Imports
io.vertx.core.Promise, .Vertx, io.vertx.core.impl.VertxBuilder, io.vertx.core.shareddata.AsyncMap, .Counter, .Lock, io.vertx.core.spi.VertxServiceProvider, java.util.List, .Map

A cluster provider for Vert.x must implement this interface. In order for HA to work correctly, all implementations of this interface MUST be implemented such that: 1. Whenever a node joins or leaves the cluster the registered NodeListener (if any) MUST be called with the appropriate join or leave event. 2. For all nodes that are part of the cluster, the registered NodeListener MUST be called with the exact same sequence of join and leave events on all nodes. 3. For any particular join or leave event that is handled in any NodeListener, anywhere in the cluster, the List of nodes returned by getNodes must be identical. 4. All of the methods in the implementation must return immediately, i.e. they must not block while the operation is being executed. If the underlying implementation does block, then io.vertx.core.Vertx#executeBlocking should be used to run the operation on a worker.
Author
Tim Fox

Method Summary

Modifier and TypeMethod and Description
public void
addRegistration(String address, RegistrationInfo registrationInfo, Promise<Void> promise)
References Deprecated RegistrationInfo is deprecated or references (maybe indirectly) at least one deprecated element.

Share a new messaging handler registration with other nodes in the cluster.

public default String

Returns:

null if the cluster manager does not start a server or the host couldn't be determined
clusterHost
()

If the cluster manager has its own server for data/membership, this returns the host it is listening to.

public default String

Returns:

null if the cluster manager does not advertise a host that is different from the cluster host or the public host couldn't be determined
clusterPublicHost
()

If the cluster manager has its own server for data/membership, this returns the host it advertises to other nodes.

public <K, V> void
getAsyncMap(String name, Promise<AsyncMap<K, V>> promise)

Return an AsyncMap for the given name.

public void
getCounter(String name, Promise<Counter> promise)

Return a Counter for the given name.

public void
getLockWithTimeout(String name, long timeout, Promise<Lock> promise)

Attempts to acquire a Lock for the given name within timeout milliseconds.

public String
getNodeId()

Return the unique node identifier for this node.

public NodeInfo
getNodeInfo()
References Deprecated NodeInfo is deprecated or references (maybe indirectly) at least one deprecated element.

Get details about this clustered node.

public void
getNodeInfo(String
the clustered node id
nodeId
,
Promise<NodeInfo> promise)

Get details about a specific node in the cluster.

public List<String>
getNodes()

Return a list of node identifiers corresponding to the nodes in the cluster.

public void
getRegistrations(String address, Promise<List<RegistrationInfo>> promise)

Get the messaging handler currently registered in the cluster.

public <K, V> Map<K, V>
getSyncMap(String name)

Return a synchronous map for the given name.

public default void
init(VertxBuilder
the builder
builder
)

Implements io.vertx.core.spi.VertxServiceProvider.init.

Let the provider initialize the Vert.x builder.

public void
init(Vertx
the Vert.x instance
vertx
,
NodeSelector
the NodeSelector that must receive RegistrationUpdateEvent.
nodeSelector
)

Invoked before this cluster node tries to join the cluster.

public boolean

Returns:

true if active, false otherwise
isActive
()

Is the cluster manager active?

public void
join(Promise<Void> promise)

Join the cluster.

public void
leave(Promise<Void> promise)

Leave the cluster.

public void
nodeListener(NodeListener listener)

Set a listener that will be called when a node joins or leaves the cluster.

public void
removeRegistration(String address, RegistrationInfo registrationInfo, Promise<Void> promise)
References Deprecated RegistrationInfo is deprecated or references (maybe indirectly) at least one deprecated element.

Signal removal of a messaging handler registration to other nodes in the cluster.

public void
setNodeInfo(NodeInfo nodeInfo, Promise<Void> promise)
References Deprecated NodeInfo is deprecated or references (maybe indirectly) at least one deprecated element.

Store the details about this clustered node.

Method Detail

addRegistrationback to summary
public void addRegistration(String address, RegistrationInfo registrationInfo, Promise<Void> promise)

References Deprecated

RegistrationInfo is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Share a new messaging handler registration with other nodes in the cluster.

clusterHostback to summary
public default String clusterHost()

If the cluster manager has its own server for data/membership, this returns the host it is listening to. When users don't configure the eventbus cluster host, the value will serve as a default.

Returns:String

null if the cluster manager does not start a server or the host couldn't be determined

clusterPublicHostback to summary
public default String clusterPublicHost()

If the cluster manager has its own server for data/membership, this returns the host it advertises to other nodes. When users don't configure the eventbus cluster public host, the value will serve as a default.

Returns:String

null if the cluster manager does not advertise a host that is different from the cluster host or the public host couldn't be determined

getAsyncMapback to summary
public <K, V> void getAsyncMap(String name, Promise<AsyncMap<K, V>> promise)

Return an AsyncMap for the given name.

getCounterback to summary
public void getCounter(String name, Promise<Counter> promise)

Return a Counter for the given name.

getLockWithTimeoutback to summary
public void getLockWithTimeout(String name, long timeout, Promise<Lock> promise)

Attempts to acquire a Lock for the given name within timeout milliseconds.

getNodeIdback to summary
public String getNodeId()

Return the unique node identifier for this node.

getNodeInfoback to summary
public NodeInfo getNodeInfo()

References Deprecated

NodeInfo is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Get details about this clustered node.

getNodeInfoback to summary
public void getNodeInfo(String nodeId, Promise<NodeInfo> promise)

Get details about a specific node in the cluster.

Parameters
nodeId:String

the clustered node id

getNodesback to summary
public List<String> getNodes()

Return a list of node identifiers corresponding to the nodes in the cluster.

getRegistrationsback to summary
public void getRegistrations(String address, Promise<List<RegistrationInfo>> promise)

Get the messaging handler currently registered in the cluster.

getSyncMapback to summary
public <K, V> Map<K, V> getSyncMap(String name)

Return a synchronous map for the given name.

initback to summary
public default void init(VertxBuilder builder)

Implements io.vertx.core.spi.VertxServiceProvider.init.

Doc from io.vertx.core.spi.VertxServiceProvider.init.

Let the provider initialize the Vert.x builder.

Parameters
builder:VertxBuilder

the builder

Annotations
@Override
initback to summary
public void init(Vertx vertx, NodeSelector nodeSelector)

Invoked before this cluster node tries to join the cluster.

Implementations must signal the provided nodeSelector when messaging handler registrations are added or removed by sending a RegistrationUpdateEvent with NodeSelector#registrationsUpdated(RegistrationUpdateEvent).

Parameters
vertx:Vertx

the Vert.x instance

nodeSelector:NodeSelector

the NodeSelector that must receive RegistrationUpdateEvent.

isActiveback to summary
public boolean isActive()

Is the cluster manager active?

Returns:boolean

true if active, false otherwise

joinback to summary
public void join(Promise<Void> promise)

Join the cluster.

leaveback to summary
public void leave(Promise<Void> promise)

Leave the cluster.

nodeListenerback to summary
public void nodeListener(NodeListener listener)

Set a listener that will be called when a node joins or leaves the cluster.

removeRegistrationback to summary
public void removeRegistration(String address, RegistrationInfo registrationInfo, Promise<Void> promise)

References Deprecated

RegistrationInfo is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Signal removal of a messaging handler registration to other nodes in the cluster.

setNodeInfoback to summary
public void setNodeInfo(NodeInfo nodeInfo, Promise<Void> promise)

References Deprecated

NodeInfo is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Store the details about this clustered node.