I am enhancing this sample https://www.mastertheboss.com/bpm/jbpm6/jbpm-6-web-application-example/. I have a requirement to get deployment id and the process id of a process instances that completed in the history. So that I can rerun the workflow using a historical deployment id and a process id.
I tried to implement that by providing an identifier when starting the process and later query it using the same identifier. For that I created a CorrelationKey using an id and included that as an argument to startProcess(). But, when I try to query using the same correlationKey, it does not provide any results.
How I start process,
@Bean
public CorrelationKeyFactory correlationKeyFactory(){
return new JPACorrelationKeyFactory();
}
private CorrelationKey generateCorrelationKey(String key) {
return factory.newCorrelationKey(key);
}
CorrelationKey correlationKey = generateCorrelationKey("1234);
Long processInstanceId = processService.startProcess("business-application-kjar-1_0-SNAPSHOT", "com.mastertheboss.LicenseDemo", correlationKey, vars);
How I query,
CorrelationKey correlationKey = generateCorrelationKey("1234");
ProcessInstanceDesc processInstanceById = runtimeDataService.getProcessInstanceByCorrelationKey(correlationKey);
However, if I query using process instance id, it provides results
runtimeDataService.getProcessInstanceById(processId)