Skip to main content

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

Constructor Alerts Description
(constructor)(agentScheduler, taskId) Beta Constructs a new instance of the TaskSubscription class

Properties

Property Alerts Modifiers Type Description
taskId Beta readonly string

Methods

Method Alerts Return Type Description
haveTask() Beta boolean Check if currently holding ownership of the task.
volunteer() Beta void 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.

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

Parameter Type Description
agentScheduler IAgentScheduler The AgentScheduler that will be subscribed against
taskId string The 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;