I know how to use the fluent API to generate BPMN.
But have no idea how to deploy the generated BPMN at runtime.
I tried the below code to deploy the BPMN but it does not work.
repositoryService.createDeployment().addModelInstance(key + ".bpmn",instance).deploy();
and
Deployment deployment = repositoryService.createDeployment().
enableDuplicateFiltering(true).
tenantId(null)
.addInputStream("12312313213123.bpmn",
new ByteArrayInputStream(
((GeneratedProcessDefinition) definition).getBpmn().getBytes())
).deploy();
Above code not throw any exception but after that executed when I try to get the process definition by the key the process engine says there is no such process definition exists.
How can I deploy a BPMN at runtime?
Thanks.