Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

Historian SDK

Checking the Redundant Historian Connection Status

The HistorianConnectionStatus class is used for MultiHistorianAccess in the same way as for HistorianAccess, except it represents a combined multi-historian connection status aggregated from two internal HistorianConnectionStatus sub-objects depending on whether the multi-historian connection was initiated by OpenConnection() or OpenConnectionToAll().

Example

HistorianConnectionStatus multiConnectionStatus = new HistorianConnectionStatus();
for (;;)
{
    multiHistorian.GetConnectionStatus(ref multiConnectionStatus);
    if (!multiConnectionStatus.Pending)
        break;
    Console.WriteLine("Multi-historian connection is pending");
    Thread.Sleep(1000);       
}

if (multiConnectionStatus.ErrorOccurred)
    Console.WriteLine("Multi-historian connection failed: {0}",
        multiConnectionStatus.Error.ErrorDescription);
else
{
    Console.WriteLine("Multi-historian: Server = {0}, ServerStorage = {1}, S/F = {2}",
        multiConnectionStatus.ConnectedToServer,
        multiConnectionStatus.ConnectedToServerStorage,
        multiConnectionStatus.ConnectedToStoreForward);

    foreach (HistorianConnectionStatus connectionStatus in multiConnectionStatus)
    {
        Console.WriteLine("ServerName = {0}, Server = {1}, ServerStorage = {2}, S/F = {3}",
            connectionStatus.ServerName,
            connectionStatus.ConnectedToServer,
            connectionStatus.ConnectedToServerStorage,
            connectionStatus.ConnectedToStoreForward);
    }
}

In most cases, it is sufficient to check the combined multi-connection status, but if it is necessary to determine the connection status of every partner historian connection, it can be done by iterating the collection of HistorianConnectionStatus sub-objects, where the ServerName property will reflect the name of the corresponding partner historian.