Hello,
We are working on a project which actively is using the Flowable engine in order to manage processes. Our business case scenario includes some actions over processes. For instance, abort a process, retry failed process, resume a suspended process, start a new process, etc.
Currently, in order to implement those functionalities one should use the ManagementService, the RuntimeService, the RepositoryService, the HistoryService. Using those services, a lot of deep knowledge in the flowable engine is required in order to fulfil the above actions over a process.
Here is an example:
In order to start a process, one should use the below piece of code:
ProcessDefinitionQuery query = engine.getRepositoryService()
.createProcessDefinitionQuery()
.processDefinitionKey(processDefinitionKey)
.latestVersion();
String processDefinitionId = query.singleResult()
.getId();
ProcessInstance processInstance = engine.getRuntimeService()
.startProcessInstanceById(processDefinitionId, variables);
It will be much easier to just use the following:
engine.getServices().startProcessInstance(processDefinitionKey, variables);
or if an abortion of the process is required(deletion of the process instance):
engine.getServices().abortProcessInstance(processInstanceId); - for aborting processes
or if a retry is needed(for instance, when the process has a failed job and a retry of the failed job is needed):
engine.getServices().retryProcessInstanceExecution(processInstanceId);
of if a resume is necessary(for instance when the process is at receive task):
engine.getServices().resumeSuspendedProcessInstance(processInstanceId);
Do you think that such an simplification is sufficient and could be used?
Please correct me if there is already such mechanisms in the engine I would be glad to find and use them
Thanks in advance,
Encho