Start Process Instance By Message

It looks like the only way to run this is using Java Delegate code.
There seems to be no way to add a piece of Groovy script just to add this code, specially to declare variables in the Map.

Can I add this code as part of a Expression? Seems a bit problematic not to have this and to have to end using Java for such a simple communication.

Thanks,
Leonardo

execution.getProcessEngineServices().getRuntimeService().createMessageCorrelation("work").correlateWithResult()

Docs:
https://docs.camunda.org/javadoc/camunda-bpm-platform/7.7/org/camunda/bpm/engine/RuntimeService.html

https://docs.camunda.org/javadoc/camunda-bpm-platform/7.7/org/camunda/bpm/engine/RuntimeService.html#correlateMessage(java.lang.String)

You can call this snippet of code as a expression as well by wrapping it in ${execution.getprocessengineservice......}

1 Like

Thank you. I could make it work without the need to run Java.
But I needed to start another process via messaging and send variables:

${execution.getProcessEngineServices().getRuntimeService().startProcessInstanceByMessage("insured-summary", variables)}

The good thing is I could setup the variables in the input/output via a Map and worked great! :smiley:

1 Like

@homer1980 take a look at the message correlation builder: https://docs.camunda.org/javadoc/camunda-bpm-platform/7.7/org/camunda/bpm/engine/runtime/MessageCorrelationBuilder.html#setVariable(java.lang.String,%20java.lang.Object)

You can also use .setVariable('myVarName', 'myVarValue') in the expression/script