I'm successfully using Activiti via the Spring Boot Starter for a while and am attempting to change from automatically deploying bpmn processes to manually doing it via Java. I basing this on a fairly simple example which is finding my process definitions and completing, but not creating a deployment with usable process definitions.
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();
Previously when I used auto deployment I would see records in the re_procdef table for each process and be able to query and use them. When I run the above code I only see records in the ge_bytearray table which contain the process xml in the BYTES_ field as a blob, but no deployed process.
Can anyone see what I am doing wrong?
delete the deployment entry from database or give new name for every depolyment in application.properties file spring.activiti.deployment-name=nameofthedeployment