如何使用REST API在Activiti中启动工作流程

编程入门 行业动态 更新时间:2024-10-11 17:22:50
本文介绍了如何使用REST API在Activiti中启动工作流程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我已经使用带有Eclipse的服务任务等创建了一个Activit流程,并将.bar部署到了在tomcat上运行的Activiti。它已成功部署,我可以使用activiti-explorer启动我的过程,而不会出现任何问题。部署的流程名称为我的流程,它也在Activiti-Explorer中的流程->部署的流程定义下列出。在图中,它的名称为 myProcess:1:1473

I have created a Activit Process using Service Tasks etc with eclipse and deployed the .bar to Activiti which is running on tomcat. It was successfully deployed I can start my process using activiti-explorer without any issue. The deployed process name is "My process" and it is listed under Processes->Deployed Process Definitions in the Activiti-Explorer as well. In the diagram it has the name "myProcess:1:1473"

但是我有两个问题。

  • 我需要使用REST调用开始我的过程。 (即,不使用Activiti-explorer)。该网址是什么?我尝试了几种( http:// localhost:8080 / activiti-rest / service / runtime / process-instances ),但它们都不起作用。
  • 重新启动tomcat时,我的流程实例未显示在Activit -explorer中。每次重新启动时,我都需要重新部署.bar文件。
  • I need to start my process using REST call. (i.e. Without using Activiti-explorer) . What is the URL for that? I tried several variations of (localhost:8080/activiti-rest/service/runtime/process-instances) but none of them working.
  • When I restart the tomcat my process instance is not shown in the Activit -explorer. Each time I restart I need to redeploy the process .bar file. Is that the natural behavior of the engine?
推荐答案

  • 对于第一个问题,请查看本指南以获取更多详细信息:

    • For your first question check this guide for further details:

      POST运行时/流程实例应该是您的端点(一定要进行 POST 请求,并以 application / json 作为您的内容类型)

      POST runtime/process-instances should be your endpoint (Be sure to make a POST request, with application/jsonas your content type)

      另一方面,应对有效负载进行格式化在以下三个模板之一中:

      The payload on the other hand should be formatted in one of three templates:

      请求正文(按流程定义ID开头):

      { processDefinitionId: oneTaskProcess:1:158, businessKey: myBusinessKey, variables:[ { name: myVar, value:这是一个变量,} ] }

      请求正文(以流程定义键开头):

      { processDefinitionKey: oneTaskProcess, businessKey: myBusinessKey, tenantId: tenant1,变量:[ { name: myVar, value:这是一个变量 ,} ] }

      请求正文(按消息开头):

      { message: newOrderMessage, businessKey: myBusinessKey, tenantId: tenant1,变量:[ { name: myVar, value:这是一个变量,} ] }

    • 至于第二个问题,您应该意识到,OOTB(即用型)配置可能会在每次重新启动时涉及自动DB清理,您需要找到该配置并使用您选择的值覆盖它!检查此部分以获取更多信息, databaseSchemaUpdate 参数可能正好您正在寻找什么!

    • As for your second issue, you should be aware that the OOTB (Out Of The Box) config may involve automatic DB cleaning upon each and every restart, you need to locate that config and override it with values of your choice! Check this section for further info, the databaseSchemaUpdate param might be exactly what you are looking for!

更多推荐

如何使用REST API在Activiti中启动工作流程

本文发布于:2023-11-28 12:08:57,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1642337.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何使用   工作流程   API   REST   Activiti

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!