Define throw Message event in Camunda


#1

Hi all,
is it possible to define full details for throwing a message event only using the Modeler? I am not talking about defining a simple message but providing the process instance id or correlationKeys as well without any Java code.

Basically, we want to achieve this only by using the Modeler (no Java delegates nor non-Java similar code written in Expression):
delegateExecution.getProcessEngineServices()
.getRuntimeService()
.createMessageCorrelation(“FilesReceived_” + ((Account) delegateExecution.getVariable(“account”)).getId())
.processInstanceId(delegateExecution.getProcessInstanceId())
.correlate();

Where can we define in the Modeler the processInstanceId or correlationKeys? I see tabs called Input/Output and Field injections but we don’t know what they can be used for.

Thanks in advance,
Paul Palacean


#2

Hi @ppalacean,

Yep, you can do it using a scripting language. Here is a Groovy example which runs in an a task execution listener inline script field in Modeller, hence scope is task, not execution:

String taskId = task.getId()
String instance_id = task.getProcessInstanceId()

task.getProcessEngineServices().getRuntimeService().createMessageCorrelation("ReviewStart").processInstanceId(instance_id).setVariable("task_link", taskId).correlate()

Best regards,
Ilya


#3

Hi @Ilya_Malyarenko
I was wondering if there is a way to configure processId, correlation keys and sent variables using Modeler UI, without Java code or scripting language (Groovy). But I guess there isn’t such possibility from what I’ve read on other posts.

Thanks,
Paul Palacean


#4

Hi @ppalacean,

In general, you can easily avoid using Java, but you can’t do much without scripting in Camunda. Initially I was using JavaScript as a scripting option, but after several months migrated almost 99% of the code to Groovy as it is much more comfortable choice, especially when you need OOP and easy access to Java functions.

BR,
Ilya