Send a message event via REST API



I have questions regarding a 7.8 new feature : the ability to send a message event via REST API.

Here's my need :
During the lifecycle of a case, I need to wait at a given point for an external backend to send back data for defining the assignee of the next task. The assignee differ from case to case.

I thought about using a receive message task (or event, I couldn't find the difference). Then the backend will send a message event (using REST API ) with the necessary data for the case to move forward.

All of this works well with the exception that the endpoint does not allow to specify the case I want to send the message to.

It appears that the endpoint send the message to the first case set in pending state. Not all of them, nor a specific case or flowNode id.

Therefore I wonder how to send an message event to a given case or flownode id.

How would you accomplish such a task ?

Thanks for your help

2 answers

This one is the BEST answer!

Actually you should:

  • Include as part of your message the process instance id of the process instance you are targeting. To do so, in the message API request payload, include a "correlation" key named for example processInstanceIdKey (type java.lang.Long) and set it's value with the process instance id you want to send the message to.
  • Next in configure the catch message event: select the message, in the "General" -> "Correlation" tab, add the process key: the left column should be the name of the key (e.g. "processInstanceIdKey") and the right column should define the expected value of the key. To define the value, use a Groovy script that simply returns processInstanceId (this is a provided variable available in the drop down list in the Groovy script editor).

The difference between catch message event and task is only that the task can define operations and connectors (only on catch message task for connectors).


Submitted by pierre.deville on Tue, 05/28/2019 - 14:33


Thank you for your answer and your explanations.

I ended up doing exactly what you described and it's working flawlessly




This works perfectly, but is there a way to send data in the event and to populate process variables with the received message content ?

In the message I send using the API, I have defined a set of key/value pairs I would like to retrieve.

In the 'message content' section, the only expressions available to populate variables are constants and message data id.

In the documentation it seems this mapping can only be done based on an existing throw message definition, where the structure can be defined, but in my case the message is sent using an API, not across pools so I do not have this message definition anywhere.

Thanks for any help