Table of Contents

Class ApiModuleClient<TSossObject>

Namespace
Scaleout.Modules.Client
Assembly
Scaleout.Modules.Client.dll

Strongly-typed client for invoking operations on a ScaleOut API module.

public class ApiModuleClient<TSossObject>

Type Parameters

TSossObject

Type 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

cache Cache<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 cache is 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

objectId string

ID of the object in the ScaleOut service to invoke the operation on.

operationId string

Name of the operation to invoke in the module, as defined on an ApiProcessor<TSossObject>'s method with a OperationId.

args byte[]

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

objectId string

ID of the object in the ScaleOut service to invoke the operation on.

operationId string

Name of the operation to invoke in the module, as defined on an ApiProcessor<TSossObject>'s method with a OperationId.

args byte[]

Serialized argument sent to the operation handler method.

Returns

Task<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.