Skip to main content
Version: v2

TaskSubscription Class

TaskSubscription works with an AgentScheduler to make it easier to monitor a specific task ownership.

This API is provided for existing users, but is not recommended for new users.

To use, import via @fluidframework/agent-scheduler/legacy.

For more information about our API support guarantees, see here.

Signature​

export declare class TaskSubscription extends TypedEventEmitter<ITaskSubscriptionEvents>

Extends: TypedEventEmitter<ITaskSubscriptionEvents>

Constructors​

ConstructorAlertsDescription
(constructor)(agentScheduler, taskId)BetaConstructs a new instance of the TaskSubscription class

Properties​

PropertyAlertsModifiersTypeDescription
taskIdBetareadonlystring

Methods​

MethodAlertsReturn TypeDescription
haveTask()BetabooleanCheck if currently holding ownership of the task.
volunteer()BetavoidVolunteer for the task. By default, the TaskSubscription will only watch the task and not volunteer. This is safe to call multiple times across multiple TaskSubscriptions.

Constructor Details​

(constructor)​

Constructs a new instance of the TaskSubscription class

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Signature​

constructor(agentScheduler: IAgentScheduler, taskId: string);

Parameters​

ParameterTypeDescription
agentSchedulerIAgentSchedulerThe AgentScheduler that will be subscribed against
taskIdstringThe string ID of the task to subscribe against

Property Details​

taskId​

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Signature​

readonly taskId: string;

Type: string

Method Details​

haveTask​

Check if currently holding ownership of the task.

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Signature​

haveTask(): boolean;

Returns​

true if currently the task owner, false otherwise.

Return type: boolean

volunteer​

Volunteer for the task. By default, the TaskSubscription will only watch the task and not volunteer. This is safe to call multiple times across multiple TaskSubscriptions.

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Signature​

volunteer(): void;