Skip to content

IGrainContext Methods

Represents a grain from the perspective of the runtime.

Activate(Dictionary<string, object>, CancellationToken)

abstract
public abstract void Activate(Dictionary<string, object>? requestContext, CancellationToken cancellationToken = default(CancellationToken))
Start activating this instance.

Parameters

requestContextDictionary<string, object>
The request context of the request which is causing this instance to be activated, if any.
cancellationTokenCancellationToken
A cancellation token which, when canceled, indicates that the process should complete promptly.

Deactivate(DeactivationReason, CancellationToken)

abstract
public abstract void Deactivate(DeactivationReason deactivationReason, CancellationToken cancellationToken = default(CancellationToken))
Start deactivating this instance.

Parameters

deactivationReasonDeactivationReason
The reason for deactivation, for informational purposes.
cancellationTokenCancellationToken
A cancellation token which, when canceled, indicates that the process should complete promptly.

Migrate(Dictionary<string, object>, CancellationToken)

abstract
public abstract void Migrate(Dictionary<string, object>? requestContext, CancellationToken cancellationToken = default(CancellationToken))
Starts an attempt to migrating this instance to another location. Migration captures the current RequestContext, making it available to the activation's placement director so that it can consider it when selecting a new location. Migration will occur asynchronously, when no requests are executing, and will not occur if the activation's placement director does not select an alternative location.

Parameters

requestContextDictionary<string, object>
The request context, which is provided to the placement director so that it can be examined when selecting a new location.
cancellationTokenCancellationToken
A cancellation token which, when canceled, indicates that the process should complete promptly.

ReceiveLocalRequest(ILocalRequest, LocalRequestOptions)

virtual
View source
public virtual void ReceiveLocalRequest(ILocalRequest request, LocalRequestOptions options)
Queues request as a one-way request on this instance.

Parameters

requestILocalRequest
The request to invoke. Its IInvokable method must return an interface type.
optionsLocalRequestOptions
The options for the request.

Exceptions

System.NotSupportedException
This instance does not support local requests.

ReceiveMessage(object)

abstract
public abstract void ReceiveMessage(object message)
Submits an incoming message to this instance.

Parameters

messageobject
The message.

Rehydrate(IRehydrationContext)

abstract
public abstract void Rehydrate(IRehydrationContext context)
Start rehydrating this instance from the provided rehydration context.

Parameters

contextIRehydrationContext

SetComponent(TComponent?)

abstract
public abstract void SetComponent<TComponent>(TComponent? value)
Sets the provided value as the component for type TComponent.

Parameters

valueTComponent?
The component instance.