code: public List<Task> getPendingTasksByType(String taskType, @Nullable String startKey, @Nullable Integer count) {
          Preconditions.checkArgument(StringUtils.isNotBlank(taskType), "Task type cannot be blank");
  
          TaskServicePb.TasksInProgressRequest.Builder request = TaskServicePb.TasksInProgressRequest.newBuilder();
          request.setTaskType(taskType);
          if (startKey != null) {
              request.setStartKey(startKey);
          }
          if (count != null) {
              request.setCount(count);
          }
  
          return stub.getTasksInProgress(request.build())
                  .getTasksList()
                  .stream()
                  .map(protoMapper::fromProto)
                  .collect(Collectors.toList());
      }
docs: Retrieve pending tasks by type
  
  @param taskType Type of task
  @param startKey id of the task from where to return the results. NULL to start from the beginning.
  @param count    number of tasks to retrieve
  @return Returns the list of PENDING tasks by type, starting with a given task Id.