Hi,
I have created subprocess and subprocess has parallel gateway to process the post process activities. Below is my workflow design.
Initially I have not created message correlation for subprocess. With no correlation message creation, parallel gateway was not executing and unable to process any post process delegate. Then I realised the correlation message and created it. However I am still getting nullpointer for few variables (Ex: Activity) after creating the message correlation. Please suggest me what I missed in my delegate class.
Java code:
@Component(value = "postProcessExecutionDelegate")
public class PostProcessExecutionDelegate implements JavaDelegate {
@Override
public void execute(DelegateExecution execution) {
log.info("Executing sub post processing for Envelope Review: {}", execution.getBusinessKey());
String messageName = extractThrowEventMessageName(execution);
execution.getProcessEngineServices().getRuntimeService()
.createMessageCorrelation(messageName)
.processInstanceId(execution.getProcessInstanceId())
.processInstanceBusinessKey(execution.getProcessBusinessKey())
.correlateExclusively();
}
private String extractThrowEventMessageName(DelegateExecution execution) {
ThrowEvent messageEvent = (ThrowEvent) execution.getBpmnModelElementInstance();
MessageEventDefinition messageEventDefinition = (MessageEventDefinition) messageEvent.getEventDefinitions()
.iterator()
.next();
return messageEventDefinition.getMessage().getName();
}
}