public class CuratorLeaderElection extends Object
CuratorLeaderElection
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 with a single server that should be marked as master.
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 |
---|
CuratorLeaderElection(org.apache.camel.CamelContext camelContext,
String uri) |
Modifier and Type | Method and Description |
---|---|
boolean |
addElectionWatcher(ElectionWatcher e) |
String |
getCandidateName() |
static boolean |
isCamelStopping(org.apache.camel.CamelContext context) |
boolean |
isMaster() |
void |
shutdownClients() |
public CuratorLeaderElection(org.apache.camel.CamelContext camelContext, String uri)
public static boolean isCamelStopping(org.apache.camel.CamelContext context)
public void shutdownClients()
public boolean isMaster()
public String getCandidateName()
public boolean addElectionWatcher(ElectionWatcher e)
Apache Camel