Activiti 进程未部署

问题描述 投票:0回答:1

我通过 Spring Boot Starter 成功使用 Activiti 一段时间,并尝试从自动部署 bpmn 流程更改为通过 Java 手动部署。我基于一个相当简单的示例,该示例查找并完成流程定义,但没有创建具有可用流程定义的部署。

BpmnXMLConverter bpmnXMLConverter = new BpmnXMLConverter();
String processFolderPath = "classpath:/processes/";
File processDirectory = resourceLoader.getResource(processFolderPath).getFile();
DeploymentBuilder builder = repositoryService.createDeployment();
if (processDirectory.exists()) { Arrays.stream(Objects.requireNonNull(processDirectory.list())).sequential()
            .forEach(processDefFile -> {
                try {
                    String resource = processFolderPath + processDefFile;
                    InputStream input = resourceLoader.getResource(resource).getInputStream();
                    InputStreamSource streamSource = new InputStreamSource(input);
                    BpmnModel model = bpmnXMLConverter.convertToBpmnModel(streamSource, true, false);
                    String processDefName = processDefFile.substring(0, processDefFile.indexOf(".bpmn20.xml"));
                    builder.addBpmnModel(processDefName, model);
                } catch (IOException e) {
                    log.error(e.getMessage(), e);
                }
            });
    } else {
        log.warn("process directory not found");
    }
    builder.deploy();

以前,当我使用自动部署时,我会在 re_procdef 表中看到每个进程的记录,并能够查询和使用它们。当我运行上面的代码时,我只看到 ge_bytearray 表中的记录,其中 BYTES_ 字段中的进程 xml 作为 blob 包含,但没有部署的进程。

任何人都可以看到我做错了什么吗?

java activiti bpmn
1个回答
0
投票

从数据库中删除部署条目或为 application.properties 文件中的每个部署指定新名称 spring.activiti.deployment-name=部署名称

© www.soinside.com 2019 - 2024. All rights reserved.