Hi everyone,
I am trying to start a process in Camunda 7 and simultaneously send a message (with “Intermediate Throw Event”) that is related to this process through an “Intermediate Catch Event”.
What I want to do is that the “message sent” event triggers the “message came” event in another process instance. I am implementing a JavaClass in the message intermediate throw event:
import org.camunda.bpm.engine.RuntimeService;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.JavaDelegate;
import org.springframework.stereotype.Component;
@Component
public class SendMessageDelegation implements JavaDelegate {
private final RuntimeService runtimeService;
public SendMessageDelegation(RuntimeService runtimeService) {
this.runtimeService = runtimeService;
}
@Override
public void execute(DelegateExecution delegateExecution) throws Exception {
String messageName = "MensajePreventivoRiesgo";
runtimeService.createMessageCorrelation(messageName)
.correlate();
System.out.println("Evento de mensaje 'MensajePreventivoRiesgo' disparado.");
}
}
But I obtain this error:
This is the elements configuration
-
For message intermediate throw event:
-
For message intermediate catch event:
I would be immensely grateful if someone could explain to me how this type of event works in this case. The process I have has two lanes, the idea being that instances are executed in each one.
Thanks for you attention!