cluster feature

Cluster Feature

Version: 17.07

Supported Since: 17.01

Cluster Feature

As mentioned before, this feature is used to expose all the functionalities provided by the UltraESB-X clustering including,

  • Acquiring Distributed locks

  • Obtaining distributed sequence numbers

  • Publishing distributed commands which will be executed by all the nodes in the same command space

In order to get a better understanding, let’s go through the APIs of the cluster feature and understand what each of those APIs do.

APIs Java Docs

All the following APIs, except "isClusteringEnabled()" can throw "IntegrationRuntimeException" if called while clustering is not enabled. Therefore, you must check if clustering is enabled using "isClusteringEnabled" before using any other API.

getClusterLock

Parameters
String lockPath

The ZNode path to be used to create the cluster lock.

Returns
XClusterLock

This API will return a lock object of type XClusterLock which is unique to the given "lockPath". It can be used in the future to acquire the distributed lock for the above mentioned "lockPath". No two nodes in the cluster will be able to acquire a cluster lock for a given "lockPath" at the same time. If another node wants that lock, it has to wait till the first node release the lock.

This API will create an XClusterLock object which can be used to acquire a lock which will guarantee a critical section between different instances of UltraESB-X.

getNextSequenceNumber

Parameters
String path

The ZNode path to be used to create the distributed sequence.

Returns
Optional<Integer>

This API will return an optional integer. Users have to check whether a value exists. If the optional has no value, that means that the sequence number generation has failed.

Generates a distributed sequence number which is the next in line of a distributed sequence. Users have to check the returned optional to obtain the sequence number.

publishControlCommand

Parameters
XControlCommand command

The command to be published.

Returns
String

This API will returns the name of the "ZNode" which was created in order to publish the command. The returned ZNode path name will look like "ControlCommand_xxxxxxxxxx" where the prefix ControlCommand is appended with 10 digits assigned when creating "SEQUENTIAL_PERSISTENT" nodes in zookeeper.

A control command can be any class which is implementing "org.adroitlogic.x.api.clustering.XControlCommand". We marshal and publish the command to the cluster. All the nodes in the same "command space" will receive this command. Then they will unmarshal the received command and execute them.

isClusteringEnabled

Returns
boolean

Returns "true" if the UltraESB-X instance is configured to use clustering features.

This API can be ued to determine whether this UltraESB-X instance is using clustering.

getNodeName

Returns the node name of the UltraESB-X instance

getStatus

Returns the status of the UltraESB-X cluster manager.

getCommandSpace

Returns the command space name of the UltraESB-X instance

getDomain

Returns the domain name of the UltraESB-X instance

In this topic
In this topic
Contact Us