ExecRemoteGatewayCachedBusinessRule
When a cache flag and key is provided to the ExecRemoteGatewayBusinessRule BRAPI, this method is used to invoke a previously cached method. This is intended to be used for high-frequency remote business rules to avoid the performance impact of recompiling a remote method on each invocation.
NOTE:
Parameter details:
-
si: SessionInfo object used to create connection objects
-
cachedFunctionKey: Key of previously cached remote function to invoke
-
functionArguments: Array of objects aligning to function / method parameters. Null / Nothing if there are none required
-
remoteHost: Name of remote host to invoke operation. (Smart Integration Connector Local Gateway Name)
-
executionTimeOut: Timeout (in seconds) on the remote job
-
Returns: RemoteRequestResultDto - Result of execution including the status and any exceptions which may have occurred on the remote endpoint
Here is the rule in C#:
// ExecRemoteGatewayCachedBusinessRule
// Execute and cache a remote SIC Function for later use
var GatewayName = ""; // Name of the Gateway
var SICFunctionName = ""; // Name of the SIC Function to run
var RemoteMethodName = ""; // Name of the method inside the SIC Function that will be called
var SICCachedFunctionName = ""; // Name of the cache key for this SIC Function, which can be called on subsequent requests
RemoteRequestResultDto objRemoteRequestResultDto = BRApi.Utilities.ExecRemoteGatewayBusinessRule(si, SICFunctionName, null, GatewayName, RemoteMethodName, SICCachedFunctionName, false, 90);
if (BRApi.Utilities.IsRemoteDtoSuccessful(si, objRemoteRequestResultDto)
&& objRemoteRequestResultDto.ResultType == RemoteResultType.DataTable)
{
BRApi.ErrorLog.LogMessage(si, "Data Returned - Rows:" + objRemoteRequestResultDto.ResultSet.Rows.Count);
}
else
{
if (objRemoteRequestResultDto.RemoteException != null)
{
throw ErrorHandler.LogWrite(si, new XFException(si, objRemoteRequestResultDto.RemoteException));
}
else
{
BRApi.ErrorLog.LogMessage(si, "Remote Smart Integration Function Succeeded - no data/datatable returned");
}
}
// Subsequent invocations of the remote BR can be run by specifying the endpoint and the cached key name
RemoteRequestResultDto objRemoteRequestResultDtoCached = BRApi.Utilities.ExecRemoteGatewayCachedBusinessRule(si, SICCachedFunctionName , null, GatewayName, 90);
Here is the rule in VB.NET:
' ExecRemoteGatewayCachedBusinessRule
' Execute and cache a remote SIC Function for later use
Dim GatewayName As String = "" ' Name of the Gateway
Dim SICFunctionName As String = "" ' Name of the SIC Function to run
Dim RemoteMethodName As String = "" ' Name of the method inside the SIC Function that will be called
Dim SICCachedFunctionName As String = "" ' Name of the cache key for this SIC Function, which can be called on subsequent requests
Dim objRemoteRequestResultDto As RemoteRequestResultDto = BRApi.Utilities.ExecRemoteGatewayBusinessRule(si, SICFunctionName, Nothing, GatewayName, RemoteMethodName, SICCachedFunctionName, False, 90)
If (BRApi.Utilities.IsRemoteDtoSuccessful(si, objRemoteRequestResultDto) AndAlso objRemoteRequestResultDto.ResultType = RemoteResultType.DataTable) Then
BRApi.ErrorLog.LogMessage(si, "Data Returned - Rows:" + objRemoteRequestResultDto.ResultSet.Rows.Count)
Else
If (objRemoteRequestResultDto.RemoteException IsNot Nothing) Then
Throw ErrorHandler.LogWrite(si, New XFException(si, objRemoteRequestResultDto.RemoteException))
Else
BRApi.ErrorLog.LogMessage(si, "Remote Smart Integration Function Succeeded - no data/datatable returned")
End If
End If
' Subsequent invocations of the remote BR can be run by specifying the endpoint and the cached key name
Dim objRemoteRequestResultDtoCached As RemoteRequestResultDto = BRApi.Utilities.ExecRemoteGatewayCachedBusinessRule(si, SICCachedFunctionName, Nothing, GatewayName, 90)


