标签:task 8080 externalTask http camunda localhost
这个是别人翻译的官方文档: 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里)
能看到卡在批准付款里:
问题来了:
怎么批准呢?这个按钮置灰的,到这里不会了。待续。。。
标签:task,8080,externalTask,http,camunda,localhost 来源: https://www.cnblogs.com/dayanjing/p/15126298.html
本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享; 2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关; 3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关; 4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除; 5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。