Universal Messaging Scheduling : Cluster Triggers Example
/*
This script tests the cluster triggers. It is assumed the cluster is created with 4 realms
named realm1, realm2, realm3, realm4
*/
scheduler myCluster{
declare Cluster myNode1("realm1");
declare Cluster myNode2("realm2");
declare Cluster myNode3("realm3");
declare Cluster myNode4("realm4");
/*
This will trigger when realm1 is online to the cluster
*/
when ( myNode1.isOnline == true ){
Logger.report("Realm1 online");
}
/*
This can also be written as
*/
when ( Cluster.isOnline("realm1") == true ){
Logger.report("Realm1 online");
}
when ( myNode2.isOnline == true ){
Logger.report("Realm2 online");
}
when ( myNode3.isOnline ==true ){
Logger.report("Realm3 online");
}
when ( myNode4.isOnline == true ){
Logger.report("Realm4 online");
}
when ( Cluster.hasQuorum == true ){
Logger.report("Cluster now has quorum and is running" );
}
when ( Cluster.isMaster == true){
Logger.report("This local realm is the master realm of the cluster");
}
}