Class ApiModuleClient
Client for invoking operations on a ScaleOut API module.
public class ApiModuleClient
- Inheritance
-
ApiModuleClient
- Inherited Members
Constructors
ApiModuleClient(string, GridConnection)
Initializes a new instance of the ApiModuleClient class, which can be used to invoke methods in an API module.
public ApiModuleClient(string moduleName, GridConnection gridConnection)
Parameters
moduleNamestringThe name of the module to associate with this client. Must not be null or empty.
gridConnectionGridConnectionScaleout.Client GridConnection used to connect to the ScaleOut service.
Remarks
API module implementors can subclass this class to provide a customized client for a module, using the Invoke(string, string, byte[]?) method to invoke operations on objects in the module.
Exceptions
- ArgumentNullException
Thrown if
gridConnectionis null.- ArgumentException
Thrown if
moduleNameis null or empty.
Methods
Invoke(string, string, byte[]?)
Invokes an operation on a object in the API module.
public virtual byte[]? Invoke(string objectId, string operationId, byte[]? args)
Parameters
objectIdstringID of the object in the ScaleOut service to invoke the operation on.
operationIdstringName of the operation to invoke in the module, as defined on an ApiProcessor<TSossObject>'s method with a OperationId.
argsbyte[]Serialized argument sent to the operation handler method.
Returns
- byte[]
The byte array returned by the module's operation handler method.
Exceptions
- InvalidOperationException
The specified operationId was not defined in the API module. Verify [SossApiMethod] OperationIds in the module's ApiProcessor.
- KeyNotFoundException
The specified objectId was not found in the ScaleOut service and the API method was not marked with [SossApiMethod(ObjNotFoundBehavior = ObjNotFoundBehavior.Create)], or the ApiProcessor's CreateObject implementation returned null.
- ScaleoutModuleException
The operation handler threw an unhandled exception.
- Exception
The ScaleOut service returned an unexpected response code.
InvokeAsync(string, string, byte[]?)
Invokes an operation on a object in the API module.
public virtual Task<byte[]?> InvokeAsync(string objectId, string operationId, byte[]? args)
Parameters
objectIdstringID of the object in the ScaleOut service to invoke the operation on.
operationIdstringName of the operation to invoke in the module, as defined on an ApiProcessor<TSossObject>'s method with a OperationId.
argsbyte[]Serialized argument sent to the operation handler method.
Returns
Exceptions
- InvalidOperationException
The specified operationId was not defined in the API module. Verify [SossApiMethod] OperationIds in the module's ApiProcessor.
- KeyNotFoundException
The specified objectId was not found in the ScaleOut service and the API method was not marked with [SossApiMethod(ObjNotFoundBehavior = ObjNotFoundBehavior.Create)], or the ApiProcessor's CreateObject implementation returned null.
- ScaleoutModuleException
The operation handler threw an unhandled exception.
- Exception
The ScaleOut service returned an unexpected response code.