Use Flowable programatically without xml

Hi Flowable,

I am trying to put in place a system that will run some processes. All of them will have to respect an order that will be defined dynamically. Some of the processes will have to run in parallel also during the sequence flow.

From my understanding, flowable could help me to have a complete solution for the present but even for the future (be able to stop at a step of the sequence flow in case of failure and restart from that step).

To have a better view I tried to do the get started part and I understood easily how to use it with the XML. From that point I tried to configure everything without xml doing like this

    ProcessEngineConfiguration cfg = new StandaloneProcessEngineConfiguration()

    ProcessEngine processEngine = cfg.buildProcessEngine();

    BpmnModel bpmnModel = new BpmnModel();
    Process process = new Process();

    StartEvent startEvent = new StartEvent();

    SequenceFlow sequenceFlow = new SequenceFlow("startEvent","approveTask");

    ExclusiveGateway exclusiveGateway = new ExclusiveGateway();

    SequenceFlow sequenceFlow2 = new SequenceFlow("decision","externalSystemCall");
    SequenceFlow sequenceFlow3 = new SequenceFlow("decision","sendRejectionMail");

    SequenceFlow sequenceFlow4 = new SequenceFlow("externalSystemCall","holidayApprovedTask");

    SequenceFlow sequenceFlow5 = new SequenceFlow("holidayApprovedTask","approveEnd");

    EndEvent endEvent = new EndEvent();


    RepositoryService repositoryService = processEngine.getRepositoryService();
    Deployment deployment = repositoryService.createDeployment().addBpmnModel("holidayRequest", bpmnModel).deploy();

    ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery()
    System.out.println("Found process definition : " + processDefinition.getName());

    RuntimeService runtimeService = processEngine.getRuntimeService();
    ProcessInstance processInstance =

I think it is not the good way to do that and I have some errors the processDefinition seems not to be well defined.

Thanks in advance if someone could help me.

1 Like

Not sure what you’re looking for? Yes, the api you’re currently using is the low-level one that can be used to generate the XML or deploy directly to the engine.

Thanks for your reply. I think after more analysis that flowable will not fit with my needs so I ll try a less document oriented solution like JBPM.