Table of Contents

Class ApiModuleClient

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

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

moduleName string

The name of the module to associate with this client. Must not be null or empty.

gridConnection GridConnection

Scaleout.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 gridConnection is null.

ArgumentException

Thrown if moduleName is 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

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.