Class MessageModuleClient<TSossObject>
Strongly-typed client for sending messages to message module objects.
public class MessageModuleClient<TSossObject> : MessageModuleClient
Type Parameters
TSossObjectType 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
cacheCache<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
moduleNamestringName of the module to send messages to.
gridConnectionGridConnectionScaleout.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
moduleNamestringName of the module to send messages to.
gridConnectionGridConnectionScaleout.Client GridConnection used to connect to the ScaleOut service.
serializerAction<TSossObject, Stream>Custom serializer used to update module objects using the Cache property.
deserializerFunc<Stream, TSossObject>Custom deserializer used to read module objects using the Cache property.
Exceptions
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
objectIdstringID of the object to send a message to.
messagebyte[]Message payload.
timeoutTimeSpan?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
timeoutelapsed.- OperationCanceledException
The operation timed out, typically because too many pending requests accumulated in the client and the
timeoutelapsed.- ScaleoutModuleException
An unhandled exception occurred in the module while processing the message.