Table of Contents

Class MessageModuleClient<TSossObject>

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

Strongly-typed client for sending messages to message module objects.

public class MessageModuleClient<TSossObject> : MessageModuleClient

Type Parameters

TSossObject

Type of the object in the ScaleOut StateServer (SOSS) service that's associated with the message module.

Inheritance
MessageModuleClient<TSossObject>
Inherited Members

Remarks

If objects in the ScaleOut service do not need to be directly accessed, you can use the non-generic MessageModuleClient class instead.

Constructors

MessageModuleClient(Cache<string, TSossObject>)

Initializes a new instance of the MessageModuleClient class.

public MessageModuleClient(Cache<string, TSossObject> cache)

Parameters

cache Cache<string, TSossObject>

A cache instance used to store and retrieve objects associated with messages.

MessageModuleClient(string, GridConnection)

Constructs a MessageModuleClient for the specified module name and grid connection.

public MessageModuleClient(string moduleName, GridConnection gridConnection)

Parameters

moduleName string

Name of the module to send messages to.

gridConnection GridConnection

Scaleout.Client GridConnection used to connect to the ScaleOut service.

MessageModuleClient(string, GridConnection, Action<TSossObject, Stream>, Func<Stream, TSossObject>)

Initializes a new instance of the MessageModuleClient class.

public MessageModuleClient(string moduleName, GridConnection gridConnection, Action<TSossObject, Stream> serializer, Func<Stream, TSossObject> deserializer)

Parameters

moduleName string

Name of the module to send messages to.

gridConnection GridConnection

Scaleout.Client GridConnection used to connect to the ScaleOut service.

serializer Action<TSossObject, Stream>

Custom serializer used to update module objects using the Cache property.

deserializer Func<Stream, TSossObject>

Custom deserializer used to read module objects using the Cache property.

Exceptions

ArgumentNullException

Properties

Cache

Gets the client's underlying Scaleout.Client.Cache<TKey, TValue> instance that can be used to access the module's underlying objects in the ScaleOut StateServer service.

public Cache<string, TSossObject> Cache { get; }

Property Value

Cache<string, TSossObject>

Methods

SendMessageAsync(string, byte[], TimeSpan?)

Sends a message to the specified object in the message module.

public override Task SendMessageAsync(string objectId, byte[] message, TimeSpan? timeout = null)

Parameters

objectId string

ID of the object to send a message to.

message byte[]

Message payload.

timeout TimeSpan?

The amount of time allowed for this operation. After the expires, the operation will be canceled. You may specify null or Zero if you want the operation to continue no matter how long it takes. If the timeout elapses, a Scaleout.Client.TimeoutException or OperationCanceledException will be thrown (depending on whether the timeout occurred in the service or in the client process).

Returns

Task

The task object representing the asynchronous operation.

Exceptions

NotReadyException

The ScaleOut service is not yet ready to perform this operation, typically because there was no application registered to handle events for the specified moduleName.

TimeoutException

The operation timed out in the server and the timeout elapsed.

OperationCanceledException

The operation timed out, typically because too many pending requests accumulated in the client and the timeout elapsed.

ScaleoutModuleException

An unhandled exception occurred in the module while processing the message.