public interface RedundancyManager
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CONFIG_UPDATES_GAUGE |
static java.lang.String |
CONFIG_UPDATES_GAUGE_MAX |
static java.lang.String |
RUNTIME_UPDATES_GAUGE |
static java.lang.String |
RUNTIME_UPDATES_GAUGE_MAX |
static java.lang.String |
SYSTEM_ID |
Modifier and Type | Method and Description |
---|---|
void |
addMessageReceiver(java.lang.String protocol,
MessageReceiver recv)
Adds a message receiver for the clustered task system.
|
void |
addRedundancyStateListener(RedundancyStateListener l)
The redundancy state listener will be notified each time there is a change to any part of the redundancy state.
|
void |
applySettings(RedundancySettings settings) |
java.io.Serializable |
executeTask(RedundantTask task)
Takes a RedundantTask and executes it locally before replicating it to the clustered backup node.
|
java.io.Serializable |
executeTask(RedundantTask task,
boolean async) |
java.io.Serializable |
executeTask(java.lang.String protocol,
java.io.Serializable message)
This executes a task locally, and then replicates the task to the backup node IF the execution didn't produce an
exception.
|
java.io.Serializable |
executeTask(java.lang.String protocol,
java.io.Serializable message,
boolean async) |
void |
forceConfigurationSync()
Requests that the system execute a full config sync.
|
GatewayAddressGroup |
getAllHttpAddresses()
Lists the HTTP urls for the gateways in the redundant cluster.
|
java.lang.Object |
getConfigLock()
The following were part of the cluster manager, and may or may not be appropriate for this interface.
|
RedundancyState |
getCurrentState() |
java.lang.String |
getLocalAddress()
Returns the network address of the local machine.
|
java.lang.Long |
getMasterStartTime()
Returns the time, coordinated for this node, that the master last started.
|
java.util.List<MetricValue> |
getMetrics() |
com.inductiveautomation.metro.api.ServerId |
getPeerAddress()
Returns the gateway network server id of the peer
Warning: may return null if redundant servers are not connected
|
PeerStatus |
getPeerConnectionStatus() |
default SystemMap |
getPeerSystemMap()
Deprecated.
|
RuntimeStateManager |
getRuntimeStateManager()
Provides the RuntimeStateManager.
|
RedundancySettings |
getSettings() |
boolean |
isActive()
Returns whether the system is currently "active", i.e., the node should be running fully.
|
boolean |
isAutoDetectHttp() |
boolean |
isMaster()
Returns whether this node's responsibility is MASTER.
|
boolean |
isRedundancyEnabled() |
void |
postTask(java.lang.String protocol,
java.io.Serializable message)
Similar to executeTask, but does not deliver the task locally before sending it on.
|
void |
removeMessageReceiver(java.lang.String protocol,
MessageReceiver recv) |
void |
removeRedundancyStateListener(RedundancyStateListener l) |
void |
requestPeerActivityLevel(ActivityLevel level)
Request that the peer assume either Active or Inactive activity.
|
void |
shutdown() |
static final java.lang.String SYSTEM_ID
static final java.lang.String RUNTIME_UPDATES_GAUGE
static final java.lang.String RUNTIME_UPDATES_GAUGE_MAX
static final java.lang.String CONFIG_UPDATES_GAUGE
static final java.lang.String CONFIG_UPDATES_GAUGE_MAX
RedundancyState getCurrentState()
PeerStatus getPeerConnectionStatus()
boolean isRedundancyEnabled()
boolean isActive()
This should be checked by any part of the system that should base its state on whether or not this node is "responsible" or active. When the node is not active, the system should likely not do things like write to the PLC, query the database, etc. However, that is ultimately up to the module, and will likely involve looking at the full cluster state for the real state - ie, cold, hot, active.
Note: it is safe to check this even when redundancy isn't enabled- in that case, it will always return true.
boolean isMaster()
To reiterate: this should only be used in relation to configuration related changes.
void requestPeerActivityLevel(ActivityLevel level)
void forceConfigurationSync()
java.lang.Long getMasterStartTime()
void addRedundancyStateListener(RedundancyStateListener l)
void removeRedundancyStateListener(RedundancyStateListener l)
void addMessageReceiver(java.lang.String protocol, MessageReceiver recv)
protocol
- a unique string identifier for messages that will be delivered to the given receiver.recv
- a listener who will receive clustered tasks sent on the specified protocol.void removeMessageReceiver(java.lang.String protocol, MessageReceiver recv)
java.io.Serializable executeTask(java.lang.String protocol, java.io.Serializable message) throws java.lang.Exception
This overload takes a protocol ID and serializable message. The message will be delivered to any MessageReceivers registered for that protocol, both locally and remotely.
java.lang.Exception
java.io.Serializable executeTask(java.lang.String protocol, java.io.Serializable message, boolean async) throws java.lang.Exception
java.lang.Exception
void postTask(java.lang.String protocol, java.io.Serializable message) throws java.lang.Exception
java.lang.Exception
java.io.Serializable executeTask(RedundantTask task) throws java.lang.Exception
java.lang.Exception
executeTask(String, Serializable)
java.io.Serializable executeTask(RedundantTask task, boolean async) throws java.lang.Exception
java.lang.Exception
RuntimeStateManager getRuntimeStateManager()
void shutdown()
RedundancySettings getSettings()
void applySettings(RedundancySettings settings)
java.lang.Object getConfigLock()
boolean isAutoDetectHttp()
GatewayAddressGroup getAllHttpAddresses()
@Deprecated default SystemMap getPeerSystemMap()
java.util.List<MetricValue> getMetrics()
java.lang.String getLocalAddress()
com.inductiveautomation.metro.api.ServerId getPeerAddress()