Zeebe receive and message event tasks


#1

Can you please explain the zeebe receive task and message event with an usecase?


#2

Hi @Ramya,

The Receive Task and Intermediate Message Catch Event serve the same general purpose. They indicate that a message must be received by Zeebe and correlated to a workflow instance before that instance can proceed to the next step.

We talk through message correlation, including a sample use case, in this blog post.

The message correlation entry in the reference section of the docs might also be helpful for you.

There’s one primary difference between the Receive Task and the Intermediate Message Catch Event, which is that boundary events can be attached to the Receive Task. Below’s a simplified order example. Imagine you have a process where you initiate a payment to be processed by some external system, then wait for a message from that system to confirm that the payment was received, then ship the order. If you haven’t received that “Payment Received” message within 1 hour, you assume there’s a problem, and you want to look into what’s going on. So you attach a non-interrupting timer boundary event to escalate after 1 hour.

Only the Receive Task makes it possible to attach that timer boundary event.

A couple more things here.

There are other types of message events, too:
• Message Start Events make it possible to create a workflow instance based on the publishing of a message (see docs).
• Message Boundary Events can be attached to tasks or subprocesses (see docs), similar to the Timer Boundary Event used in the example above.

We talked more about message and timer boundary / start events in the Zeebe 0.15 release blog post: https://zeebe.io/blog/2019/02/zeebe-0-15-release-bpmn-features-kafka-summit/

Hope this helps!

Best,
Mike


#3

Hi @wints,

Thanks for the clarification, if possible could you share the examples for zeebe Receive Task and Intermediate Message Catch Event. I tried implementing and also checked for references but couldn’t get it working.

Thanks,
Ramya.


#4

Hi @Ramya, happy to help. Where did you run into an issue - configuring the message / receive task in the Modeler or trying to publish a message and correlate it to a workflow instance, or something else?

Also, what version of Zeebe are you using?


#5

How would this workflow handle a “Payment Received”-message arriving AFTER the 1-hour trigger that ends the workflow in state “Issue Escalated”? What would be the correct way to handle such real life anomalies in Zeebe?


#6

Hi @wints,

Im using zeebe-0.15.0-alpha1, i have configured service task, receive task(with correlation id) in modeller and implemented them as microservices in java. Issue is receive task is not picking up the message though i can see the message in open status in monitor. Could you please share any examples for the receive task implementation.

Thanks,
Ramya.


#7

Hi @Ramya,

I just ran a quick test with the Zeebe CLI (using the most recent Zeebe 0.15.0, not the alpha) to confirm that I could complete a Service Task then correlate a message to a Receive Task.

The BPMN model I used is here: https://github.com/wints/receive-task-test/blob/master/receive-task-test.bpmn

After the Zeebe broker was started, the commands I ran (I’m on a Mac) were:

./bin/zbctl.darwin deploy receive-task-test.bpmn

./bin/zbctl.darwin create instance receive-task-test --payload '{"orderId": "1234"}'

./bin/zbctl.darwin create worker process-payment --handler cat

./bin/zbctl.darwin publish message "payment-received" --correlationKey="1234"

We don’t yet have a Java example for publishing a message in the docs, but you can find one in the tests.

Perhaps the issue is a correlation key mismatch. Was the correlation key set in the workflow instance payload when you created it? Did your process have an incident?

Anyway, hope this helps, and let me know if you have any follow-up questions!

Best,
Mike