Class TaskuraiTaskContext
Task context
Assembly: Taskurai.Worker.dll
public class TaskuraiTaskContext
Properties
TaskResponse
Task dequeue response (Taskurai.Models.TaskDequeueResponse) from a RetrieveQueuedTask call.
public TaskDequeueResponse TaskResponse { get; }
Task
Task response (Taskurai.Worker.TaskuraiTaskContext.TaskResponse) to handle.
public TaskResponse Task { get; }
RequestedVersion
Requested version by task (null if no version specified)
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>.
public TaskResponse UpdateTask(UpdateTaskInput input, CancellationToken? cancellationToken = null)
Returns
Taskurai.Models.TaskResponse: Taskurai.Worker.TaskuraiTaskContext.TaskResponse
Parameters
Type | Name | Description |
---|---|---|
Taskurai.Models.UpdateTaskInput | input | Taskurai.Models.UpdateTaskInput. |
System.Nullable<System.Threading.CancellationToken> | cancellationToken | System.Threading.CancellationToken |
ProgressAsync(double?, string, CancellationToken?)
Updates progress and sends a heartbeat.
Required scope: Taskurai.Task.Update
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
Type | Name | Description |
---|---|---|
System.Nullable<System.Double> | progress | Report progress % (optional). |
System.String | message | Progress message (optional). |
System.Nullable<System.Threading.CancellationToken> | cancellationToken | System.Threading.CancellationToken |
Progress(double?, string, CancellationToken?)
Updates progress and sends a heartbeat.
Required scope: Taskurai.Task.Update
public TaskResponse Progress(double? progress = null, string message = null, CancellationToken? cancellationToken = null)
Returns
Taskurai.Models.TaskResponse: Taskurai.Worker.TaskuraiTaskContext.TaskResponse
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<System.Double> | progress | Report progress % (optional). |
System.String | message | Progress message (optional). |
System.Nullable<System.Threading.CancellationToken> | cancellationToken | System.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>.
public Task<TaskResponse> UpdateTaskAsync(UpdateTaskInput input, CancellationToken? cancellationToken = null)
Returns
System.Threading.Tasks.Task<Taskurai.Models.TaskResponse>
: Taskurai.Worker.TaskuraiTaskContext.TaskResponse
Parameters
Type | Name | Description |
---|---|---|
Taskurai.Models.UpdateTaskInput | input | Taskurai.Models.UpdateTaskInput. |
System.Nullable<System.Threading.CancellationToken> | cancellationToken | System.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>.
public TaskExtendResponse ExtendTask(ExtendTaskInput input, CancellationToken? cancellationToken = null)
Returns
Taskurai.Models.TaskExtendResponse: Taskurai.Models.TaskExtendResponse
Parameters
Type | Name | Description |
---|---|---|
Taskurai.Models.ExtendTaskInput | input | Taskurai.Models.ExtendTaskInput. |
System.Nullable<System.Threading.CancellationToken> | cancellationToken | System.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>.
public Task<TaskExtendResponse> ExtendTaskAsync(ExtendTaskInput input, CancellationToken? cancellationToken = null)
Returns
System.Threading.Tasks.Task<Taskurai.Models.TaskExtendResponse>
: Taskurai.Models.TaskExtendResponse
Parameters
Type | Name | Description |
---|---|---|
Taskurai.Models.ExtendTaskInput | input | Taskurai.Models.ExtendTaskInput. |
System.Nullable<System.Threading.CancellationToken> | cancellationToken | System.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>.
public TaskExtendResponse ExtendTask(double visibilityTimeout, CancellationToken? cancellationToken = null)
Returns
Taskurai.Models.TaskExtendResponse: Taskurai.Models.TaskExtendResponse
Parameters
Type | Name | Description |
---|---|---|
System.Double | visibilityTimeout | Time in seconds the task is invisible to other instances of the worker (default 300, max 7 days). |
System.Nullable<System.Threading.CancellationToken> | cancellationToken | System.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>.
public Task<TaskExtendResponse> ExtendTaskAsync(double visibilityTimeout, CancellationToken? cancellationToken = null)
Returns
System.Threading.Tasks.Task<Taskurai.Models.TaskExtendResponse>
: Taskurai.Models.TaskExtendResponse
Parameters
Type | Name | Description |
---|---|---|
System.Double | visibilityTimeout | Time in seconds the task is invisible to other instances of the worker (default 300, max 7 days). |
System.Nullable<System.Threading.CancellationToken> | cancellationToken | System.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>.
public TaskResponse CompleteTask(CompleteTaskInput input, CancellationToken? cancellationToken = null)
Returns
Taskurai.Models.TaskResponse: Taskurai.Worker.TaskuraiTaskContext.TaskResponse
Parameters
Type | Name | Description |
---|---|---|
Taskurai.Models.CompleteTaskInput | input | Taskurai.Models.CompleteTaskInput. |
System.Nullable<System.Threading.CancellationToken> | cancellationToken | System.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>.
public Task<TaskResponse> CompleteTaskAsync(CompleteTaskInput input, CancellationToken? cancellationToken = null)
Returns
System.Threading.Tasks.Task<Taskurai.Models.TaskResponse>
: Taskurai.Worker.TaskuraiTaskContext.TaskResponse
Parameters
Type | Name | Description |
---|---|---|
Taskurai.Models.CompleteTaskInput | input | Taskurai.Models.CompleteTaskInput. |
System.Nullable<System.Threading.CancellationToken> | cancellationToken | System.Threading.CancellationToken |