ExecRemoteGatewayJobAndWait

This BRAPI manages a long-running job process using other business rules. It is the preferred method for users looking to get a response from a remote gateway job without adding boilerplate polling logic to get a result. The BRAPI first performs ExecRemoteGatewayJob to start a new gateway job, then checks the status of that job by calling GetRemoteGatewayJobStatus.

Here is a basic overview of the long-running job process in C#.

Copy
// ExecRemoteGatewayJobAndWait basic example
 
var GatewayName = ""; // Name of the Gateway
var SICBRName = ""; // Name of the SIC BR
var SICFunctionName = ""; // Name of the SIC Function to run
var argTest = new object[2];
argTest[0] = 100; // Example first argument to SIC Function
argTest[1] = "test"; // Example second argument to SIC Function
var Timeout = 30; // Timespan in minutes until function will time out. Default is 30 mins. Max is 4 hours.
var Polling = 60; // Timespan in seconds until function will check for an updated status.

RemoteJobStatusResultDto jobStatusResult = BRApi.Utilities.ExecRemoteGatewayJobAndWait(si, SICBRName, argTest , GatewayName, SICFunctionName, Timeout , Polling);
if(jobStatusResult.RemoteJobState == RemoteJobState.Completed)
{
      RemoteRequestResultDto result = jobStatusResult.RemoteJobResult;
      // Perform logic on result.
}

Here is the basic example in VB:

Copy
' ExecRemoteGatewayJobAndWait basic example
 
Dim GatewayName As String = ""
Dim SICBRName As String = ""
Dim SICFunctionName  As String= ""
Dim argTest = New Object(1) {}
argTest(0) = 100
argTest(1) = "test"
Dim Timeout As Integer = 30
Dim Polling As Integer = 60
Dim jobStatusResult As RemoteJobStatusResultDto = BRApi.Utilities.ExecRemoteGatewayJobAndWait(si, SICBRName, argTest, GatewayName, SICFunctionName, Timeout, Polling)

If jobStatusResult.RemoteJobState = RemoteJobState.Completed Then
      Dim result As RemoteRequestResultDto = jobStatusResult.RemoteJobResult
End If