Show / Hide Table of Contents

# Interface ITasksService

Operations related to the management of asynchronous tasks. Tasks are started by operations that are available on other interfaces, this interfaces handles operations on already started tasks.

##### Syntax

    public interface ITasksService

### Methods

#### CancelTask(Guid)

Cancels a pending task. Cancellation may not be instantaneous.

##### Declaration

    TaskInfo CancelTask(Guid taskId)

##### Parameters

Type | Name | Description
--- | --- | ---
Guid | taskId | The identifier of the task; returned by the operation that started the task.

##### Returns

Type | Description
--- | ---
TaskInfo | Task status descriptor representing the state of the task at the moment of cancellation.

##### Exceptions

Type | Condition
--- | ---
UnexpectedFault | An unexpected error occurred; equivalent of an 501 'Internal server error' http result.
GenericFault | The details within the fault identify the specific error. Thrown for expected business error that have no specific faults.

#### GetTaskResult(Guid)

Gets the result of a finished task. If the task failed, a fault is returned.

##### Declaration

    TaskResult GetTaskResult(Guid taskId)

##### Parameters

Type | Name | Description
--- | --- | ---
Guid | taskId | The identifier of the task; returned by the operation that started the task.

##### Returns

Type | Description
--- | ---
TaskResult | The returned object is specific to the task. For the actual type of the returned object, please refer to the interface where the operation was started.

##### Exceptions

Type | Condition
--- | ---
UnexpectedFault | An unexpected error occurred; equivalent of an 501 'Internal server error' http result.
GenericFault | The details within the fault identify the specific error. Thrown for expected business error that have no specific faults.
TaskNotFinishedFault | Thrown if the task is not finished yet.
TaskDoesNotExistFault | Thrown if no task with the specified id is found.

#### GetTasksStatus(Guid[])

Gets status update of a tasks.

##### Declaration

    TaskInfo[] GetTasksStatus(Guid[] taskId)

##### Parameters

Type | Name | Description
--- | --- | ---
Guid[] | taskId | The identifier of the task; returned by the operation that started the task.

##### Returns

Type | Description
--- | ---
TaskInfo[] | Task status descriptor for each task identifier in the same order as the tak ids are specified.

##### Exceptions

Type | Condition
--- | ---
UnexpectedFault | An unexpected error occurred; equivalent of an 501 'Internal server error' http result.
GenericFault | The details within the fault identify the specific error. Thrown for expected business error that have no specific faults.

#### GetTaskStatus(Guid)

Gets status update of a task.

##### Declaration

    TaskInfo GetTaskStatus(Guid taskId)

##### Parameters

Type | Name | Description
--- | --- | ---
Guid | taskId | The identifier of the task; returned by the operation that started the task.

##### Returns

Type | Description
--- | ---
TaskInfo | Task status descriptor.

##### Exceptions

Type | Condition
--- | ---
UnexpectedFault | An unexpected error occurred; equivalent of an 501 'Internal server error' http result.
GenericFault | The details within the fault identify the specific error. Thrown for expected business error that have no specific faults.