這個是別人翻譯的官方文檔: https://blog.csdn.net/zoollcar/article/details/117351192
這個是官方文檔: 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里)
能看到卡在批准付款里:
問題來了:
怎么批准呢?這個按鈕置灰的,到這里不會了。待續。。。