code: public Task getPendingTaskForWorkflow(String workflowId, String taskReferenceName) {
          Preconditions.checkArgument(StringUtils.isNotBlank(workflowId), "Workflow id cannot be blank");
          Preconditions.checkArgument(StringUtils.isNotBlank(taskReferenceName), "Task reference name cannot be blank");
  
          TaskServicePb.PendingTaskResponse response = stub.getPendingTaskForWorkflow(
                  TaskServicePb.PendingTaskRequest.newBuilder()
                          .setWorkflowId(workflowId)
                          .setTaskRefName(taskReferenceName)
                          .build()
          );
          return protoMapper.fromProto(response.getTask());
      }
docs: Retrieve pending task identified by reference name for a workflow
  
  @param workflowId        Workflow instance id
  @param taskReferenceName reference name of the task
  @return Returns the pending workflow task identified by the reference name