I am trying to dynamically generate the workflow file for Flowable and deploy it on the go.
There are two challenges: 1. Create BAR file to package the XML that is generated 2. Deploying it dynamically.
Has anyone ever tried this? If yes, could you please help or suggest an alternative
Accomplished this finally. The only thing I needed to understand was that BAR file is nothing by a normal ZIP file. It simply needs to be named with a .bar extension.
To deploy it dynamically, we need to utilise the Repository service in the Flowable engine library. Below code snippet allows you to dynamically deploy the workflow. Once deployed, you can freely delete the workflow file as the workflow is recorded in the database.
String barFileName = "path/to/process-one.bar";
ZipInputStream inputStream = new ZipInputStream(new FileInputStream(barFileName));
repositoryService.createDeployment()
.name("process-one.bar")
.addZipInputStream(inputStream)
.deploy();