BRApi.Utilities.IsGatewayOnline

The following business rule can check the status of Smart Integration Connector. You will need to replace "gateway-name" with the name of the gateway to be tested.

Here is the rule in C#:

Copy
// IsGatewayOnline
 
namespace OneStream.BusinessRule.Extender.TestHealthCheck
{
 public class MainClass
 {
 public const string GatewayName = "";
 
 public object Main(SessionInfo si, BRGlobals globals, object api, ExtenderArgs args)
 {
 try
 { 
 TestGatewayConnection(si, GatewayName);
 return null;
 }
 catch (Exception ex)
 {
 throw ErrorHandler.LogWrite(si, new XFException(si, ex));
 }
 }
 
 public void TestGatewayConnection(SessionInfo si, string gwName)
 {
 bool response = BRApi.Utilities.IsGatewayOnline(gwName);
 
 if (response)
 {
 BRApi.ErrorLog.LogMessage(si, $"Health Check Successful for {gwName}");
 }
 else
 {
 BRApi.ErrorLog.LogMessage(si, $"Health Check Failed for {gwName}");
 } 
 }
 }
}

Here is the rule in VB:

Copy
Namespace OneStream.BusinessRule.Extender.TestHealthCheck
 Public Class MainClass
 Public Const GatewayName As String = ""
 
 Public Function Main(ByVal si As SessionInfo, ByVal globals As BRGlobals, ByVal api As Object, ByVal args As ExtenderArgs) As Object
 Try
 TestGatewayConnection(si, GatewayName)
 Return Nothing
 Catch ex As Exception
 Throw ErrorHandler.LogWrite(si, New XFException(si, ex))
 End Try
 End Function
 
 Public Sub TestGatewayConnection(ByVal si As SessionInfo, ByVal gwName As String)
 Dim response As Boolean = BRApi.Utilities.IsGatewayOnline(gwName)
 
 If response Then
 BRApi.ErrorLog.LogMessage(si, $"Health Check Successful for {gwName}")
 Else
 BRApi.ErrorLog.LogMessage(si, $"Health Check Failed for {gwName}")
 End If
 End Sub
 End Class
End Namespace