Class MessageProcessingContext<TSossObject>
- Namespace
- Scaleout.Modules.Abstractions
- Assembly
- Scaleout.Modules.Abstractions.dll
Represents the context for processing a messages in a message processing module.
public abstract class MessageProcessingContext<TSossObject>
Type Parameters
TSossObject
Type of object stored in the ScaleOut StateServer (SOSS) service.
- Inheritance
-
MessageProcessingContext<TSossObject>
- Inherited Members
Remarks
This class provides methods and properties for interacting with the ScaleOut service, including sending messages, raising alerts, and accessing the associated grid connection and cache. It is supplied to your ProcessMessageAsync(MessageProcessingContext<TSossObject>, TSossObject, byte[]) implementation.
Properties
Cache
Gets a cache that can be used to access the module's objects that are stored in the ScaleOut service.
public abstract Cache<string, TSossObject> Cache { get; }
Property Value
GridConnection
Get the grid connection associated with this processing context.
public abstract GridConnection GridConnection { get; }
Property Value
- GridConnection
ModuleName
Gets the name of the module processing this message.
public abstract string ModuleName { get; }
Property Value
ObjectId
Gets the unique identifier for the object in the ScaleOut StateServer service.
public abstract string ObjectId { get; }
Property Value
Methods
SendMessageAsync(string, string, byte[], TimeSpan?)
Sends a message to a specific object in the ScaleOut service.
public abstract Task SendMessageAsync(string moduleName, string objectId, byte[] message, TimeSpan? timeout = null)
Parameters
moduleName
stringName of the module where the object resides.
objectId
stringUnique identifier for the object in the ScaleOut service.
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 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.
SendUIAlertAsync(AlertSeverity, string)
Sends a alert message to the ScaleOut user interface with the specified severity and message text.
public abstract Task SendUIAlertAsync(AlertSeverity severity, string message)
Parameters
severity
AlertSeveritySeverity level associated with the message.
message
stringText of the alert.
Returns
- Task
The task object representing the asynchronous operation.