Get External Tasks
Queries for the external tasks that fulfill given parameters. Parameters may be static as well as dynamic runtime properties of executions. The size of the result set can be retrieved by using the Get External Task Count method.
Method
GET /external-task
Parameters
Query Parameters
Name | Description |
---|---|
externalTaskId | Filter by an external task's id. |
topicName | Filter by an external task topic. |
workerId | Filter by the id of the worker that the task was most recently locked by. |
locked | Only include external tasks that are currently locked (i.e., they have a lock time and it has not expired). Value may only be true , as false matches any external task. |
notLocked | Only include external tasks that are currently not locked (i.e., they have no lock or it has expired). Value may only be true , as false matches any external task. |
withRetriesLeft | Only include external tasks that have a positive (> 0) number of retries (or null ). Value may only be true , as false matches any external task. |
noRetriesLeft | Only include external tasks that have 0 retries. Value may only be true , as false matches any external task. |
lockExpirationAfter | Restrict to external tasks that have a lock that expires after a given date. By default*, the date must have the format yyyy-MM-dd'T'HH:mm:ss.SSSZ , e.g., 2013-01-23T14:42:45.000+0200 . |
lockExpirationBefore | Restrict to external tasks that have a lock that expires before a given date. By default*, the date must have the format yyyy-MM-dd'T'HH:mm:ss.SSSZ , e.g., 2013-01-23T14:42:45.000+0200 . |
activityId | Filter by the id of the activity that an external task is created for. |
activityIdIn | Filter by the comma-separated list of ids of the activities that an external task is created for. |
executionId | Filter by the id of the execution that an external task belongs to. |
processInstanceId | Filter by the id of the process instance that an external task belongs to. |
processDefinitionId | Filter by the id of the process definition that an external task belongs to. |
tenantIdIn | Filter by a comma-separated list of tenant ids. An external task must have one of the given tenant ids. |
active | Only include active tasks. Value may only be true , as false matches any external task. |
priorityHigherThanOrEquals | Only include jobs with a priority higher than or equal to the given value. Value must be a valid long value. |
priorityLowerThanOrEquals | Only include jobs with a priority lower than or equal to the given value. Value must be a valid long value. |
suspended | Only include suspended tasks. Value may only be true , as false matches any external task. |
sortBy | Sort the results lexicographically by a given criterion. Valid values are
id , lockExpirationTime , processInstanceId , processDefinitionId , processDefinitionKey , tenantId and taskPriority .
Must be used in conjunction with the sortOrder parameter. |
sortOrder | Sort the results in a given order. Values may be asc for ascending order or desc for descending order.
Must be used in conjunction with the sortBy parameter. |
firstResult | Pagination of results. Specifies the index of the first result to return. |
maxResults | Pagination of results. Specifies the maximum number of results to return. Will return less results if there are no more results left. |
* For further information, please see the documentation.
Result
A JSON array of external task objects. Each external task object has the following properties:
Name | Value | Description |
---|---|---|
activityId | String | The id of the activity that this external task belongs to. |
activityInstanceId | String | The id of the activity instance that the external task belongs to. |
errorMessage | String | The full error message submitted with the latest reported failure executing this task;
null if no failure was reported previously or if no error message was submitted |
errorDetails | String | The error details submitted with the latest reported failure executing this task.
null if no failure was reported previously or if no error details was submitted |
executionId | String | The id of the execution that the external task belongs to. |
id | String | The id of the external task. |
lockExpirationTime | String | The date that the task's most recent lock expires or has expired. |
processDefinitionId | String | The id of the process definition the external task is defined in. |
processDefinitionKey | String | The key of the process definition the external task is defined in. |
processInstanceId | String | The id of the process instance the external task belongs to. |
tenantId | String | The id of the tenant the external task belongs to. |
retries | Number | The number of retries the task currently has left. |
suspended | Boolean | A flag indicating whether the external task is suspended or not. |
workerId | String | The id of the worker that possess or possessed the most recent lock. |
topicName | String | The topic name of the external task. |
priority | Number | The priority of the external task. |
Response Codes
Code | Media type | Description |
---|---|---|
200 | application/json | Request successful. |
400 | application/json | Returned if some of the query parameters are invalid, for example if a sortOrder parameter is supplied, but no sortBy . See the Introduction for the error response format. |
Example
Request
GET /external-task?topicName=aTopic
Response
Status 200.
[{
"activityId": "anActivityId",
"activityInstanceId": "anActivityInstanceId",
"errorMessage": "anErrorMessage",
"errorDetails": "anErrorDetails",
"executionId": "anExecutionId",
"id": "anExternalTaskId",
"lockExpirationTime": "2015-10-06T16:34:42.000+0200",
"processDefinitionId": "aProcessDefinitionId",
"processDefinitionKey": "aProcessDefinitionKey",
"processInstanceId": "aProcessInstanceId",
"tenantId": null,
"retries": 3,
"suspended": false,
"workerId": "aWorkerId",
"topicName": "aTopic",
"priority": 9
},
{
"activityId": "anotherActivityId",
"activityInstanceId": "anotherActivityInstanceId",
"errorMessage": "anotherErrorMessage",
"errorDetails": "anotherErrorDetails",
"executionId": "anotherExecutionId",
"id": "anotherExternalTaskId",
"lockExpirationTime": "2015-10-06T16:34:42.000+0200",
"processDefinitionId": "anotherProcessDefinitionId",
"processDefinitionKey": "anotherProcessDefinitionKey",
"processInstanceId": "anotherProcessInstanceId",
"tenantId": null,
"retries": 1,
"suspended": false,
"workerId": "aWorkerId",
"topicName": "aTopic",
"priority": 3
}]