Delay in User Task Availability After Process Start – Camunda 8 Spring Boot SDK 8.7

Hello community,

I’m currently working with Camunda 8 using the Spring Boot SDK (version 8.7.8) and encountering an issue regarding task availability timing.

Here’s the behavior I’m observing:

  • I start a process instance programmatically.
  • Immediately after that, I query for user tasks using newUserTaskQuery().
  • The result is empty (i.e., zero tasks found), although I expect one active user task.
  • If I wait for a few seconds (e.g., 5 seconds) and retry the same query, the expected task appears.

This makes me think that the Camunda engine needs some time to create and expose the user task due to asynchronous execution. However, I’m not sure what’s the best way to reliably detect when the user task is ready, especially when trying to implement automation or integration tests.

My questions:

  1. Is this behavior expected due to async behavior in Zeebe?
  2. What is the recommended approach to wait for or be notified when a user task becomes available after starting a process?
  3. Is there a way to get a kind of “acknowledgment” that the task was created or to hook into that event?

Any insights or best practices would be greatly appreciated.

Thank you!

Hi @abahaai, welcome to the forums. This is expected due to the asynchronous and eventually consistent design of Zeebe. You can read more about it:

The best fix is to use execution listeners, which are essentially job workers that get triggered at the start or end of any BPMN symbol. However, user task listeners aren’t available in 8.7 (they will be available in 8.8). I believe you can currently use the start execution listener, but you can’t listen to other user task lifecycle events such as assignment.