Hi i am new to camunda and switching from RHPAM (redhat jbpm engine).
We have used there a lot of intermediate message catch events. In the redhat engine the message is always send to a specific process instance id, so this is then stored on our objects so we can easily push a message to a process. Is it possible to define in the camunda modeler that the correlation key is the process instance id? is there some internal variable which points the the process instance id?
using the process instance key as correlation key is good idea in first place, but not recommended for production. The process instance is indeed designed to last, but it can be restarted to solve some issue. This would cause a change in the process instance key and destroy your binding.
My recommendation is to control message correlation by providing a process variable that serves. This process variable can be retrieved in a send task and be transferred along with the outbound message. The inbound message will still hold this information and can then use it as correlation key again.
This information can be business-wise (for example an order id, a customer id …). By doing this, you have more control over the actual correlation.
I understand that to bind the correlation key to a business object is much butter, but i would like to migrate some older processes from RHPAM to camunda. i am using everywhere the process instance id, this would cost a lot of effort to change that in the backend logic.
So is there a possibility to set a correlation key to a process instance id or not?
After testing I noticed that variables cannot be send at the same time as message, i.e. all variables which is used by message boundary event should be defined before token arrives to (wait for) that event (which is expected): - Error type: EXTRACT_VALUE_ERROR - Error message: failed to evaluate expression ‘MESSAGE_CORRELATION’: no variable found for name ‘MESSAGE_CORRELATION’
My question is what is the best practice, where to define correlation key variables?
In the service task immediately after process is started?
@mho no there is no way at the moment. This could be enabled if the processInstanceKey would somehow be available as FEEL expression input, which is not the case. As workaround, you could set the processInstanceKey after process start as variable to a process instance. This would not work if you have a process-wide event-subprocess.