Redundant State Subcription

How can I subscribe the gateway Redundant State? I am developing new OPC Drivers Modules and I need to know what is teh state of the system it is running on.

Thanks

You can get the platform RedundancyManager via the GatewayContext, which should be accessible from the DriverContext your driver has:

RedundancyManager redundancyManager = driverContext.getGatewayContext().getRedundancyManager();

From there, you can add a RedundancyStateListener:

redundancyManager.addRedundancyStateListener(new RedundancyStateListener() {
	@Override
	public void redundancyStateChanged(RedundancyState newState) {
		// TODO
	}

	@Override
	public void redundancyConnStatusChanged(ClusterPeerConnectionStatus status) {
		// TODO
	}
});

You’ll likely be interested in the ActivityLevel that you can from the RedundancyState object.

We have realized we would like to monitor the redundancy state via a timer script and gateway tags. Is there a way to add this state listener right from a startup script?

I would rather not have to make a module just to monitor this status unless I absolutely have to.

Thanks,

Just for posterity:

The following code on a gateway timer script will get the sync status of the redundant pair:
Ennumerated values are defined here: http://files.inductiveautomation.com/sdk/javadoc/ignition79/790-beta1/com/inductiveautomation/ignition/gateway/redundancy/types/ProjectState.html

from com.inductiveautomation.ignition.gateway import SRContext
contextRM = SRContext.get().getRedundancyManager()
state = contextRM.getPeerConnectionStatus().getProjectState().toString()
system.tag.write("[default]ReplicationState",state)