Class ApiProcessor<TSossObject>
- Namespace
- Scaleout.Modules.Abstractions
- Assembly
- Scaleout.Modules.Abstractions.dll
Base class for implementing a custom API module processor.
public abstract class ApiProcessor<TSossObject>
Type Parameters
TSossObjectType of object stored in the ScaleOut StateServer (SOSS) service.
- Inheritance
-
ApiProcessor<TSossObject>
- Inherited Members
Remarks
In addition to implementing a CreateObject method, an ApiProcessor implementation must implement at least one operation handler method.
The signature of the operation handler method must be marked with the SossApiMethodAttribute attribute and have the following signature:
[SossApiMethod(OperationId="Foo", LockingMode=ApiProcessorLockingMode.None, ObjectNotFoundBehavior=ObjNotFoundBehavior.Create)]
public Task<InvokeResult> FooAsync(ProcessingContext<TSossObject> context, TSossObject sossObject, byte[] args)
Methods
CreateObject(string, string)
Factory callback for creating a new TSossObject object instance.
Called by the runtime when a method is invoked on an object that does not exist in the ScaleOut service.
The GetNewObjectPolicy will be called immediately after this method returns, followed
by the operation handler method specified by the client caller.
public abstract TSossObject CreateObject(string moduleName, string objectId)
Parameters
moduleNamestringName of your API processing module, as supplied to ModulePackage.AddApiModule().
objectIdstringUnique ID of the object in the ScaleOut service.
Returns
- TSossObject
New
TSossObjectobject instance.
GetNewObjectPolicy(string, string, TSossObject)
Factory callback for creating a policy that specifies the expiration behavior for a newly created object.
public abstract NewObjectPolicy GetNewObjectPolicy(string moduleName, string objectId, TSossObject newObject)
Parameters
moduleNamestringName of your API processing module, as supplied to ModulePackage.AddApiModule().
objectIdstringUnique ID of the object in the ScaleOut service.
newObjectTSossObjectThe newly created object instance, as returned from your CreateObject implementation or a read-through operation.
Returns
- NewObjectPolicy
A policy that specifies the expiration behavior for the newly created object.