首先要用activiti-explorer画好流程图,设置好相关配置,并且导出模板,我这里导出出来是一个名为process001.bpmn20.xml的文件,首先是调用的activi的接口
我这里是把activitice的几个Service全部定义出来了,所以可以直接用
我用的jmeter进行了调试,后端是用的springboot接收
jmeter配置:
springboot配置:
@Override public String deployementProcessDefinitionByString(MultipartFile file) throws IOException{ InputStream inputStream = file.getInputStream(); BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream)); StringBuilder sb = new StringBuilder(); String line = null; while ((line = reader.readLine()) != null) { sb.append(line); } inputStream.close(); String text = sb.toString(); String name = file.getOriginalFilename(); //String name = file.getOriginalFilename().substring(0,file.getOriginalFilename().lastIndexOf(".")); //String name = "流程部署测试"; System.out.println(name); try { Deployment deployment = repositoryService//获取流程定义和部署对象相关的Service .createDeployment()//创建部署对象 .addString(name,text) .deploy();//完成部署 System.out.println("部署ID:"+deployment.getId());//1 System.out.println("部署时间:"+deployment.getDeploymentTime()); return "部署成功"; } catch (Exception e) { System.out.println("部署失败"); return "部署失败"; } }
字符流需要转化成String类型,然后获取文件名。通过文件名称和字符串进行部署,注意名字,是直接拿xml的文件,不要做任何处理