Interface IBatchTaskFactory
Factory for dealing with batch tasks. Tasks are identified by a unique name and might require a context.
Namespace: SuperOffice.CRM.BatchProcessing
Assembly: SoBatchProcessing.dll
Syntax
public interface IBatchTaskFactory
Methods
EndTaskAsync(int, CancellationToken)
Signal an executing task to end execution.
Declaration
Task EndTaskAsync(int taskId, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int | taskId | Id of the task to end. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task |
GetRunningTasks(BatchTaskState, bool?, bool?)
Returns array of running tasks in a given state.
Declaration
BatchTaskInfo[] GetRunningTasks(BatchTaskState state = 99999, bool? internalTasks = null, bool? systemTasks = null)
Parameters
Type | Name | Description |
---|---|---|
BatchTaskState | state | Only return tasks in this state |
bool? | internalTasks | |
bool? | systemTasks |
Returns
Type | Description |
---|---|
BatchTaskInfo[] | Array of running task info |
GetTaskInfo(int)
Obtain current information about the task.
Declaration
BatchTaskInfo GetTaskInfo(int taskId)
Parameters
Type | Name | Description |
---|---|---|
int | taskId | Id of the task to get Info for. |
Returns
Type | Description |
---|---|
BatchTaskInfo |
RunTaskAsync(BatchTaskInfo, string, CancellationToken)
Run the task with the given context.
Declaration
Task RunTaskAsync(BatchTaskInfo batchTaskInfo, string context, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
BatchTaskInfo | batchTaskInfo | |
string | context | |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task |
WaitForTaskCompletionAsync(int, CancellationToken)
Wait for the task to complete.
Declaration
Task<BatchTaskInfo> WaitForTaskCompletionAsync(int taskId, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int | taskId | Id of task to wait for. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<BatchTaskInfo> | Information about the completed task. |