How to control back-pressure from Java Client?


Hey guys.

I know that we implement back-pressure in Zeebe as it is also mentioned in the docs. Now I searched for some mechanics in the current Java Client but did not find any. Is it

Thanks a lot and cheerio


Hi Bernd,

Let’s consider this scenario:

  • Zeebe 0.8.0
  • The user code makes requests at a rate that is higher than what the client library can send the requests at

Then this is influenced by the zeebe.client.maxRequests configuration parameter you linked. Up to that number, the user code can submit asynchronous requests (via #executeAsync). If all these requests are in-flight and the user makes another request, then the #executeAsync blocks for up to 15 seconds (or more specifically the time that is configured via this parameter until one of the other response futures has been resolved and accessed by user code.

I wrote Zeebe 0.8.0 above, because we are quite certain we will change this in the future such that #executeAsync never blocks.

Does that make sense or are you thinking of another scenario?



Thanks! I actually also thought about the Jobs/WorkItems/Tasks streamed into the client, this rate definitely also needs to be controlled, so that the broker does not send more jobs than the client could handle respectively distributes them correctly among multiple clients. How does this work?


This is controlled by parameters. Looking at Zeebe 0.8.0, this can be done as follows for task subscriptions: For topic subscriptions, this can be done as a client configuration setting: If you set these parameters to 10,000, the broker makes sure that the client never receives more than 10,000 tasks/events at a time that it has not yet handled. So if a subscriber is rather slow, the broker will slow down with publishing events as well.

In future versions, we want to make the capacity parameter for topic subscriptions configurable on the builder.

edit: internally the client acknowledges handled events/tasks to the broker, and this is how the broker knows when to push more of them.


Thanks a lot - that answers my question and I was indeed to stupid to find this method (and I looked at the susbcrription builder). Sorry! Probably “back-pressure” should be a keyword mentioned in the Javadocs?


No worries :slight_smile:

That’s a good idea. In addition, the javadoc should explain for a setting what it is useful for instead of just listing the immediate effect. I raised an issue: