Class ApiModuleClient<TSossObject>
Strongly-typed client for invoking operations on a ScaleOut API module.
public class ApiModuleClient<TSossObject>
Type Parameters
TSossObjectType of object in the ScaleOut StateServer (SOSS) service that is associated with the API module.
- Inheritance
-
ApiModuleClient<TSossObject>
- Inherited Members
Remarks
This typed client is typically only used for advanced scenarios or testing. If objects in the ScaleOut service do not need to be directly accessed, you can use the non-generic ApiModuleClient class instead.
Constructors
ApiModuleClient(Cache<string, TSossObject>)
Creates a new instance of the ApiModuleClient<TSossObject> class.
public ApiModuleClient(Cache<string, TSossObject> cache)
Parameters
cacheCache<string, TSossObject>A Scaleout.Client.Cache<TKey, TValue> instance whose name supplied to CacheBuilder(string, GridConnection) matches the name of the API module.
Exceptions
- ArgumentNullException
The supplied
cacheis null.
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.