Executes a modification asynchronously for multiple process instances. To execute a modification synchronously,use the Execute Modification method.
For more information about the difference between synchronous andasynchronous execution of a modification, please refer to the relatedsection of the user guide.
Method
POST /modification/executeAsync
Parameters
Request Body
A JSON object with the following properties:
Name | Description |
---|---|
processDefinitionId | The id of the process definition for the modification |
skipCustomListeners | Skip execution listener invocation for activities that are started or ended as part of this request. |
skipIoMappings | Skip execution of input/output variable mappings for activities that are started or ended as part of this request. |
processInstanceIds | A list of process instance ids to modify. |
processInstanceQuery | A process instance query like the request body described by POST /process-instance . |
instructions | A JSON array of modification instructions. The instructions are executed in the order they are in. An instruction may have the following properties: |
type | Mandatory. One of the following values: cancel , startBeforeActivity , startAfterActivity , startTransition . A startBeforeActivity and cancel instructions request to enter a given activity. A startAfterActivity instruction requests to execute the single outgoing sequence flow of a given activity. A startTransition instruction requests to execute a specific sequence flow. |
activityId | Can be used with instructions of types startBeforeActivity , startAfterActivity , and cancel . Specifies the activity the instruction targets. |
transitionId | Can be used with instructions of type startTransition . Specifies the sequence flow to start. |
cancelCurrentActiveActivityInstances | Can be used with instructions of type cancel . Prevents the deletion of new created activity instances. |
|type|Mandatory. One of the following values:
cancel
, startBeforeActivity
, startAfterActivity
, startTransition
. A startBeforeActivity
and cancel
instructions request to enter a given activity. A startAfterActivity
instruction requests to execute the single outgoing sequence flow of a given activity. A startTransition
instruction requests to execute a specific sequence flow.|activityId|Can be used with instructions of types startBeforeActivity
, startAfterActivity
, and cancel
. Specifies the activity the instruction targets.|transitionId|Can be used with instructions of type startTransition
. Specifies the sequence flow to start.|cancelCurrentActiveActivityInstances|Can be used with instructions of type cancel
. Prevents the deletion of new created activity instances.|type|Mandatory. One of the following values:
cancel
, startBeforeActivity
, startAfterActivity
, startTransition
. A startBeforeActivity
and cancel
instructions request to enter a given activity. A startAfterActivity
instruction requests to execute the single outgoing sequence flow of a given activity. A startTransition
instruction requests to execute a specific sequence flow.|activityId|Can be used with instructions of types
startBeforeActivity
, startAfterActivity
, and cancel
. Specifies the activity the instruction targets.|transitionId|Can be used with instructions of type
startTransition
. Specifies the sequence flow to start.|cancelCurrentActiveActivityInstances|Can be used with instructions of type
cancel
. Prevents the deletion of new created activity instances.
Result
A JSON object corresponding to the Batch
interface in the engine. Itsproperties are as follows:
Name | Value | Description |
---|---|---|
id | String | The id of the created batch. |
type | String | The type of the created batch. |
totalJobs | Number | The total jobs of a batch is the number of batch execution jobs required to complete the batch. |
batchJobsPerSeed | Number | The number of batch execution jobs created per seed job invocation. The batch seed job is invoked until it has created all batch execution jobs required by the batch (see totalJobs property). |
invocationsPerBatchJob | Number | Every batch execution job invokes the command executed by the batch invocationsPerBatchJob times. E.g., for a process instance modification batch this specifies the number of process instances which are modified per batch execution job. |
seedJobDefinitionId | String | The job definition id for the seed jobs of this batch. |
monitorJobDefinitionId | String | The job definition id for the monitor jobs of this batch. |
batchJobDefinitionId | String | The job definition id for the batch execution jobs of this batch. |
tenantId | String | The tenant id of the batch. |
Response codes
Code | Media type | Description |
---|---|---|
200 | application/json | Request successful. |
400 | application/json | In case following parameters are missing: instructions, processDefinitionId, activityId or transitionId, processInstanceIds or processInstanceQuery, an exception of type InvalidRequestException is returned. See the Introduction for the error response format. |
Example
Request
POST /modification/executeAsync
Request Body:
{
"processDefinitionId" : "aProcessDefinitionId",
"instructions": [
{
"type": "startAfterActivity",
"activityId": "aUserTask"
},
{
"type": "cancel",
"activityId": "anotherTask",
"cancelCurrentActiveActivityInstances" : true
}
],
"processInstanceIds": [
"aProcessInstance",
"anotherProcessInstance"
],
"processInstanceQuery": {
"processDefinitionId": "aProcessDefinitionId"
},
"skipCustomListeners": true
}
Response
Status 200.
{
"id": "aBatchId",
"type": "aBatchType",
"totalJobs": 10,
"batchJobsPerSeed": 100,
"invocationsPerBatchJob": 1,
"seedJobDefinitionId": "aSeedJobDefinitionId",
"monitorJobDefinitionId": "aMonitorJobDefinitionId",
"batchJobDefinitionId": "aBatchJobDefinitionId",
"tenantId": "aTenantId"
}
原文: https://docs.camunda.org/manual/7.9/reference/rest/modification/post-modification-async/