Hi,
I tring to do message sub process which I will call from main process on a few spaces. Is any way how to call from process message event to run included subprocess? I need to checking email when I receive err response on a 5 places in process and I do not want to duplicate this logic.
Code:
@Named
@Slf4j
public class UndeliveredEmailSendMsg implements JavaDelegate {
@Override
public void execute(DelegateExecution delegateExecution) throws Exception {
delegateExecution.getProcessEngineServices().getRuntimeService()
.createMessageCorrelation("undeliveredEmailSendMsg")
.processInstanceBusinessKey(delegateExecution.getProcessBusinessKey()).correlate();
}
In BPMN a message event cannot be sent and received from the same process instance. There’s a much easier way which is to throw an escalation event.
Also the process you’ve built would interrupt the whole process if that message was in fact delivered, I suspect you don’t want that so make sure the catching event is non-interrupting.
But I need to wait untill subprocess will finish. In this flow I will changing client email adress in subprocess and then I retry to send him email again.
Because in my case I do more steps when I receive err response (right now only two of course, but in future it will be more steps) and I checking if client receive email in next three spaces in this process so I did not want to create redudant code in process.
If you want to hid the complexity of the error fixing process then you can always use an embedded sub process.
The reason i’m making the suggestion is because it’s much easier to use this pattern in a situation where you want to wait for something to finish before returning.
Yes, but still when I do some changes, I will do them in every sub process, right? So only way how to have this logic only in one space is use call activity?