Any suggestions folks?
Sachin - I do not fully understand your comment on collective. You are using PIPoint.PIData.EventPipe? And your PIPoint is on a single PI Server, no HA?
Yes I am using PIPoint.PIData.EventPipe only. And my PIPoint is on a single server only.
From what I understand you are not using a Collective (however you are refering to a 'failover' ?), but you do have multiple PI servers that have the same tags? I would assume you take care of the fanning/distribution of the data yourself?
Then I think your best option would be to detect a server fail or connection fail at regular intervals.
If you take a look at the PISDK documentation, you will find a 'TestConnection' method on the Server object. You cannot use this method, because it is labeled as 'Not Implemented'.
There is a 'Connected' boolean property in the Server Object. The PISDK documentation says the following about the property:
A Read-Only Boolean property indicating whether the Server object currently has an active connection to a PI server. Typically when first acquiring a Server object from the Servers collection and before calling the Open method, this property is false. Once the Open method has been successfully executed the connected property is true.
The object placeholder is an object expression that evaluates to a Server object.
The returned value is a Boolean.
If, before calling Open, you access any Server properties or methods which require a server connection, the PI-SDK attempts to make an implicit connection using the connection string from the last successful connection to this Server by the current process. If no connections have yet been made, the connection is attempted as if calling the Open method with no arguments.
While a PI-SDK program is running, a Server object may lose its connection to the server even though the Close method was not called. For example, the server may be shut down, or the network connection may be broken. When the PI-SDK detects this condition, it attempts to reconnect and sets the connected property as appropriate. See the topic "Reconnection" listed in the See Also section of this page for more information.
In some cases, the PI-SDK will not be aware of the lost connection and checking the Connected property may return True; but a subsequent method call or property access may return an error indicating the connection has been lost. In this case the Connected property is updated when the error is detected.
Checking the property at regular intervals is not enough. You will have to perform some kind of operation (for instance, get the snapshot of sinusoid) and then:
- Catch any communication exception from the call. If there is some sort of a connection problem, or the server is down that call will fail.
- Catch the exception, and then check the Connected property (which will, according to the documentation, be set to false).
- Do Both
You can then act accordingly and treat that PI Server as unreachable.