Lock External Task
Lock an external task by a given id for a specified worker and amount of time. Note: Attempting to lock an already locked external task with the same worker will succeed and a new lock duration will be set, starting from the current moment.
Method
POST /external-task/{id}/lock
Parameters
Path Parameters
Name | Description |
---|---|
id | The id of the external task. |
Request Body
A JSON object with the following properties:
Name | Description |
---|---|
lockDuration | The duration to lock the external task for in milliseconds. |
workerId | The ID of a worker who is locking the external task. |
Result
This method returns no content.
Response Codes
Code | Media type | Description |
---|---|---|
204 | Request successful. | |
400 | application/json | In case the lock duration is negative or the external task is already locked by
a different worker, an exception of type InvalidRequestException is
returned. See the Introduction
for the error response format. |
404 | application/json | Returned if the task does not exist. This could indicate a wrong task id as well as a cancelled task, e.g., due to a caught BPMN boundary event. See the Introduction for the error response format. |
Example
Request
POST /external-task/anId/lock
Request Body:
{
"workerId": "anId",
"lockDuration": 100000
}
Response
Status 204. No content.