Camunda提供了多种类型的变量类型支持,详情请查看官方文档
多实例节点属性有集合变量,常用于并审或调用子流程节点,示例如下:
多实例节点-人工任务-并审-集合变量名:assigneeList
<?xml version="1.0" encoding="UTF-8"?>
多实例节点-调用子流程-并行-集合变量名:itemList
<?xml version="1.0" encoding="UTF-8"?>
修改pom.xml文件,添加以下依赖:
重启服务,并部署模型,部署成功后,打开Postman或ApiPost等客户端,参考原生REST API Start Process Instance | docs.camunda.org 发起流程
请求报文:
{ "variables":{ "assigneeList":{ "value":"["bx2","bx3"]", "type":"Object", "valueInfo":{ "objectTypeName":"java.util.ArrayList", "serializationDataFormat":"application/json" } }, "starter":{ "value":"bx1", "type":"String" } }, "businessKey":"myBusinessKey2", "withVariablesInReturn":true}
响应报文:
{ "links":[ { "method":"GET", "href":"http://127.0.0.1:8080/engine-rest/process-instance/d593cf3e-8cac-11ec-b78f-8c1645647a47", "rel":"self" } ], "id":"d593cf3e-8cac-11ec-b78f-8c1645647a47", "definitionId":"Process_1fh6max:1:89fe12a3-8c7e-11ec-a02b-8c1645647a47", "businessKey":"myBusinessKey2", "caseInstanceId":null, "ended":false, "suspended":false, "tenantId":null, "variables":{ "assigneeList":{ "type":"Object", "value":"["bx2","bx3"]", "valueInfo":{ "objectTypeName":"java.util.ArrayList", "serializationDataFormat":"application/json" } }, "starter":{ "type":"String", "value":"bx1", "valueInfo":{ } } }}
登陆WebApp并切换到Tasklist执行提交节点任务到提交,检查是否可以正常提交,以及并审任务节点是否可以产生2个任务实例