Skip to main content

Class TaskuraiTaskContext

Task context

Assembly: Taskurai.Worker.dll
Declaration
public class TaskuraiTaskContext

Properties

TaskResponse

Task dequeue response (Taskurai.Models.TaskDequeueResponse) from a RetrieveQueuedTask call.

Declaration
public TaskDequeueResponse TaskResponse { get; }

Task

Task response (Taskurai.Worker.TaskuraiTaskContext.TaskResponse) to handle.

Declaration
public TaskResponse Task { get; }

RequestedVersion

Requested version by task (null if no version specified)

Declaration
public int? RequestedVersion { get; }

Methods

UpdateTask(UpdateTaskInput, CancellationToken?)

Updates a task.

Required scope: Taskurai.Task.Update

For more information, see <a href="https://docs.taskurai.com/tasks/update-task"> Updates an existing task</a>.

Declaration
public TaskResponse UpdateTask(UpdateTaskInput input, CancellationToken? cancellationToken = null)
Returns

Taskurai.Models.TaskResponse: Taskurai.Worker.TaskuraiTaskContext.TaskResponse

Parameters
TypeNameDescription
Taskurai.Models.UpdateTaskInputinputTaskurai.Models.UpdateTaskInput.
System.Nullable<System.Threading.CancellationToken>cancellationTokenSystem.Threading.CancellationToken

ProgressAsync(double?, string, CancellationToken?)

Updates progress and sends a heartbeat.

Required scope: Taskurai.Task.Update

Declaration
public Task<TaskResponse> ProgressAsync(double? progress = null, string message = null, CancellationToken? cancellationToken = null)
Returns

System.Threading.Tasks.Task<Taskurai.Models.TaskResponse>: Taskurai.Worker.TaskuraiTaskContext.TaskResponse

Parameters
TypeNameDescription
System.Nullable<System.Double>progressReport progress % (optional).
System.StringmessageProgress message (optional).
System.Nullable<System.Threading.CancellationToken>cancellationTokenSystem.Threading.CancellationToken

Progress(double?, string, CancellationToken?)

Updates progress and sends a heartbeat.

Required scope: Taskurai.Task.Update

Declaration
public TaskResponse Progress(double? progress = null, string message = null, CancellationToken? cancellationToken = null)
Returns

Taskurai.Models.TaskResponse: Taskurai.Worker.TaskuraiTaskContext.TaskResponse

Parameters
TypeNameDescription
System.Nullable<System.Double>progressReport progress % (optional).
System.StringmessageProgress message (optional).
System.Nullable<System.Threading.CancellationToken>cancellationTokenSystem.Threading.CancellationToken

UpdateTaskAsync(UpdateTaskInput, CancellationToken?)

Updates a task.

Required scope: Taskurai.Task.Update

For more information, see <a href="https://docs.taskurai.com/tasks/update-task"> Updates an existing task</a>.

Declaration
public Task<TaskResponse> UpdateTaskAsync(UpdateTaskInput input, CancellationToken? cancellationToken = null)
Returns

System.Threading.Tasks.Task<Taskurai.Models.TaskResponse>: Taskurai.Worker.TaskuraiTaskContext.TaskResponse

Parameters
TypeNameDescription
Taskurai.Models.UpdateTaskInputinputTaskurai.Models.UpdateTaskInput.
System.Nullable<System.Threading.CancellationToken>cancellationTokenSystem.Threading.CancellationToken

ExtendTask(ExtendTaskInput, CancellationToken?)

Extend the task visibility timeout to other worker instances

Required scope: Taskurai.Task.Update

For more information, see <a href="https://docs.taskurai.com/tasks/extend-task"> Extend a task</a>.

Declaration
public TaskExtendResponse ExtendTask(ExtendTaskInput input, CancellationToken? cancellationToken = null)
Returns

Taskurai.Models.TaskExtendResponse: Taskurai.Models.TaskExtendResponse

Parameters
TypeNameDescription
Taskurai.Models.ExtendTaskInputinputTaskurai.Models.ExtendTaskInput.
System.Nullable<System.Threading.CancellationToken>cancellationTokenSystem.Threading.CancellationToken

ExtendTaskAsync(ExtendTaskInput, CancellationToken?)

Extend the task visibility timeout to other worker instances

Required scope: Taskurai.Task.Update

For more information, see <a href="https://docs.taskurai.com/tasks/extend-task"> Extend a task</a>.

Declaration
public Task<TaskExtendResponse> ExtendTaskAsync(ExtendTaskInput input, CancellationToken? cancellationToken = null)
Returns

System.Threading.Tasks.Task<Taskurai.Models.TaskExtendResponse>: Taskurai.Models.TaskExtendResponse

Parameters
TypeNameDescription
Taskurai.Models.ExtendTaskInputinputTaskurai.Models.ExtendTaskInput.
System.Nullable<System.Threading.CancellationToken>cancellationTokenSystem.Threading.CancellationToken

ExtendTask(double, CancellationToken?)

Extend the task visibility timeout to other worker instances

Required scope: Taskurai.Task.Update

For more information, see <a href="https://docs.taskurai.com/tasks/extend-task"> Extend a task</a>.

Declaration
public TaskExtendResponse ExtendTask(double visibilityTimeout, CancellationToken? cancellationToken = null)
Returns

Taskurai.Models.TaskExtendResponse: Taskurai.Models.TaskExtendResponse

Parameters
TypeNameDescription
System.DoublevisibilityTimeoutTime in seconds the task is invisible to other instances of the worker (default 300, max 7 days).
System.Nullable<System.Threading.CancellationToken>cancellationTokenSystem.Threading.CancellationToken

ExtendTaskAsync(double, CancellationToken?)

Extend the task visibility timeout to other worker instances

Required scope: Taskurai.Task.Update

For more information, see <a href="https://docs.taskurai.com/tasks/extend-task"> Extend a task</a>.

Declaration
public Task<TaskExtendResponse> ExtendTaskAsync(double visibilityTimeout, CancellationToken? cancellationToken = null)
Returns

System.Threading.Tasks.Task<Taskurai.Models.TaskExtendResponse>: Taskurai.Models.TaskExtendResponse

Parameters
TypeNameDescription
System.DoublevisibilityTimeoutTime in seconds the task is invisible to other instances of the worker (default 300, max 7 days).
System.Nullable<System.Threading.CancellationToken>cancellationTokenSystem.Threading.CancellationToken

CompleteTask(CompleteTaskInput, CancellationToken?)

Mark the task as completed and report the status (Succeeded, Failed, ...).

Required scope: Taskurai.Task.Update

For more information, see <a href="https://docs.taskurai.com/tasks/complete-task"> Mark the task as completed</a>.

Declaration
public TaskResponse CompleteTask(CompleteTaskInput input, CancellationToken? cancellationToken = null)
Returns

Taskurai.Models.TaskResponse: Taskurai.Worker.TaskuraiTaskContext.TaskResponse

Parameters
TypeNameDescription
Taskurai.Models.CompleteTaskInputinputTaskurai.Models.CompleteTaskInput.
System.Nullable<System.Threading.CancellationToken>cancellationTokenSystem.Threading.CancellationToken

CompleteTaskAsync(CompleteTaskInput, CancellationToken?)

Mark the task as completed and report the status (Succeeded, Failed, ...).

Required scope: Taskurai.Task.Update

For more information, see <a href="https://docs.taskurai.com/tasks/complete-task"> Mark the task as completed</a>.

Declaration
public Task<TaskResponse> CompleteTaskAsync(CompleteTaskInput input, CancellationToken? cancellationToken = null)
Returns

System.Threading.Tasks.Task<Taskurai.Models.TaskResponse>: Taskurai.Worker.TaskuraiTaskContext.TaskResponse

Parameters
TypeNameDescription
Taskurai.Models.CompleteTaskInputinputTaskurai.Models.CompleteTaskInput.
System.Nullable<System.Threading.CancellationToken>cancellationTokenSystem.Threading.CancellationToken