Partial correlationKey


#1

Hi,

I’m wondering if a use case can be handled by Zeebe : i’d like to publish one message with multiple « business key » as a correlationId. I want different Workflow to look for each one of them on a specific part of the business Key.

To make it more concrete, imagine the following situation :

I’m a e-commerce website.

My warehouse has a service in charge of sending me « parcel sent » notifications.

Each time a parcel is sent a message is received by Zeebe with following infos :
OrderId=x,Transporter=z,trackingNumber=abc.

I want to use that message for multiple purposes :

-Each time a parcel is sent, I want the Ordrer Workflow to listen for the event to update the order status. To do this, I want it to look to the orderId only.

-Each time a parcel is sent with transporter=ups, a special Workflow has to be started to track the parcel with ups services.

-Each time a parcel is sent with fedex, a fedex tracking Workflow has to be initiated.

Is there a way to put on my messages a CorrellationKey looking like « OrderId=x&Transporter=z&trackingNumber=abc »

And in my workflow having catch message events based on Correlation like :

« OrderId=1234 »
« Transporter=UPS »
« Transporter=UPS&trackingNumber=123456 »

Or should I have an intermediate workflow and/or service responsable to transform 1 message to multiples ones with specific correlation key ?

Thanks,


#2

Hi @marcoplaut, your intuition is sound. A service that unpacks the incoming payload and manages it will work.

Another option: it looks like only one running workflow is correlated, the other two are started. You can use the same message name as a correlation message and a start message event. It will be correlated with the running workflow, and will start the Fedex and UPS workflows - these would then immediately check if there something for them in the payload, and terminate if not.

Or a hybrid: message correlation with the running workflow, and a router workflow (with the same message name as a start message event), which examines the message and starts the Fedex/UPS workflow.

Or even more simple: immediately after message correlation in the running workflow, put a router service task that examines the merged workflow state and starts the Fedex/UPS workflows as appropriate.


#3

Hi @jwulf,
Thanks for your answer : that’s what I had in mind but was wondering if there was another way to do it that i missed. Now it’s clear :slightly_smiling_face: