这个是官方文档: Get started with Camunda | docs.camunda.org
任务列表:http://localhost:8080/camunda/app/tasklist/
查看部署结果: http://localhost:8080/camunda/app/cockpit/default/#/processes
step:
抄官方文档的:
pom:
<dependency>
<groupId>org.camunda.bpm</groupId>
<artifactId>camunda-external-task-client</artifactId>
<version>7.15.0</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.6.1</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.1</version>
</dependency>
java:
public class ChargeCardWorker {
private final static Logger LOGGER = Logger.getLogger(ChargeCardWorker.class.getName());
public static void main(String[] args) {
ExternalTaskClient client = ExternalTaskClient.create()
.baseUrl("http://localhost:8080/engine-rest")
.asyncResponseTimeout(10000) // long polling timeout
.build();
// subscribe to an external task topic as specified in the process
client.subscribe("charge-card")
.lockDuration(1000) // the default lock duration is 20 seconds, but you can override this
.handler((externalTask, externalTaskService) -> {
// Put your business logic here
// Get a process variable
String item = (String) externalTask.getVariable("item");
Long amount = (Long) externalTask.getVariable("amount");
LOGGER.info("Charging credit card with an amount of '" + amount + "'€ for the item '" + item + "'...");
try {
Desktop.getDesktop().browse(new URI("https://docs.camunda.org/get-started/quick-start/complete"));
} catch (Exception e) {
e.printStackTrace();
}
// Complete the task
externalTaskService.complete(externalTask);
})
.open();
}
}
下载这两个东西:
打开1 里面的start.bat
使用2 的画布画, 要填这个: http://localhost:8080/engine-rest
画完保存并部署
再看部署结果(http://localhost:8080/camunda/app/cockpit/default/#/processes)
启动流程:
tasklist里:
启动后这个金额大于1000,就要人工审批,就在task里看的到(如果下于1000,就不会出现在task里)
能看到卡在批准付款里:
问题来了:
怎么批准呢?这个按钮置灰的,到这里不会了。待续。。。