Query Task in Wait State

Hey,
I was wondering if there is a way to create a query able to return a list of the tasks which are in wait state.
This is what I was able to produce:

    TaskService taskService = processEngine.getTaskService();
	TaskQuery query = taskService.createTaskQuery()
	                         .processInstanceId(processInstance.getId())
	                         . // not able to find a proper method to retrive the tasks in wait state;

	List<Task> tasks = query.list();
	Task task1 = tasks.get(0);
	LOGGER.info(task1.getName());

But Still I am not able to find the right method able to filter dei tasks in the way that I want.
Do you have any ideas?

1 Like

What is a wait state?

https://docs.camunda.org/manual/7.8/webapps/tasklist/task-lifecycle/

See the lifecycle of the user tasks.

1 Like

HI @rikirenz
what are you trying to achieve?
There are different wait states within the camunda engine. Depending on what you want to achieve you might use a different query.
You already mentioned the TaskQuery.
Besides Tasks, you might be interested in Jobs. You can query Jobs by using the management service:

managementService.createJobQuery()

Best
Felix