WorkFlow Inbox Query amp filter


I tried to use WorkFlow Client java API to get a task for particular user.Let’s say in the user inbox there is 1000 task. How to get only 10 task each time the user click next page (pagination)? Is that possible use fetchByQuery ??

How to use “fetchByQuery(String query)” method in WFSession object ? Does fetchByQuery method query all the task from workflow server first, and after that do the filter in the java?