Message aggregation, publish message when count more than N

I want to aggregate and count events and if the count more than some N, do something for in my example publish a message and before that the instance should be waiting for.

As I see in documentation there are two signs: correlation id and TTL, where TTL is a time-to-live. But in my case I don’t know how many time the instance should wait
Zeebe Modeler
Thanks for your answers!)

What you looking for is the Message Aggregator Pattern.

Hope that helps.


Time to live applied if event arrives BEFORE process comes to wait block. If it is waits for events it can wait forever. No time limits, if no timer on block applied

Basic misunderstanding with events:

  1. Process at point A. Event A - arrives, process go to gateway to point B. Second events A arrives. If process is in Point B, BPMN engine raises error - there are no proccess found waiting for event A. Because process is not at A wait point.
  2. You define TTL for message A. Process is at gateway point B, message A arrives, and wait for TTL ms, until engine sends error. If process comes from gateway to block A in TTL ms, engine returns process found, and counter++. In your case TTL = 1 sec will be enough, because gateway decision (time outside of block A) ordinary few ms.
  3. If process is at block “Publish Qualifying event” every A events will raise error.