Send a message event via REST API

1
0
-1

Hello,

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

1 answer

1
0
-1

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).

Notifications