public class CuratorMultiMasterLeaderElection extends Object implements org.apache.curator.framework.state.ConnectionStateListener
CuratorMultiMasterLeaderElection
uses the leader election capabilities of a
ZooKeeper cluster to control which nodes are enabled. It is typically used in
fail-over scenarios controlling identical instances of an application across
a cluster of Camel based servers. The election is configured providing the number of instances that are required to be active..
All instances of the election must also be configured with the same path on the ZooKeeper cluster where the election will be carried out. It is good practice for this to indicate the application e.g. /someapplication/someroute/ note that these nodes should exist before using the election.
See for more on how Leader election is archived with ZooKeeper.
Constructor and Description |
---|
CuratorMultiMasterLeaderElection(String uri,
int desiredActiveNodes) |
Modifier and Type | Method and Description |
---|---|
boolean |
addElectionWatcher(ElectionWatcher e) |
String |
getCandidateName() |
static boolean |
isCamelStopping(org.apache.camel.CamelContext context) |
boolean |
isMaster() |
void |
requestResource() |
void |
shutdownClients() |
void |
stateChanged(org.apache.curator.framework.CuratorFramework curatorFramework,
org.apache.curator.framework.state.ConnectionState connectionState) |
public CuratorMultiMasterLeaderElection(String uri, int desiredActiveNodes)
public static boolean isCamelStopping(org.apache.camel.CamelContext context)
public void shutdownClients()
public void requestResource()
public boolean isMaster()
public String getCandidateName()
public boolean addElectionWatcher(ElectionWatcher e)
public void stateChanged(org.apache.curator.framework.CuratorFramework curatorFramework, org.apache.curator.framework.state.ConnectionState connectionState)
stateChanged
in interface org.apache.curator.framework.state.ConnectionStateListener
Apache Camel