Package org.flowable.job.api

# Interface ExternalWorkerJobAcquireBuilder

public interface ExternalWorkerJobAcquireBuilder

Author:
  Filip Hrisafov

- ## Method Summary

  Modifier and Type
  Method
  Description
  `default List<AcquiredExternalWorkerJob>`
  `acquireAndLock(int numberOfTasks, String workerId)`
  Acquire and lock the given number of jobs for the given worker id.
  `List<AcquiredExternalWorkerJob>`
  `acquireAndLock(int numberOfTasks, String workerId, int numberOfRetries)`
  Acquire and lock the given number of jobs for the given worker id.
  `ExternalWorkerJobAcquireBuilder`
  `forUserOrGroups(String userId, Collection<String> groups)`
  Acquire only jobs where the given user or groups are authorized to execute.
  `ExternalWorkerJobAcquireBuilder`
  `onlyBpmn()`
  Acquire only jobs which are linked to a process instance.
  `ExternalWorkerJobAcquireBuilder`
  `onlyCmmn()`
  Acquire only jobs which are linked to a case instance.
  `ExternalWorkerJobAcquireBuilder`
  `scopeType(String scopeType)`
  Acquire only jobs which are linked to the given scope type.
  `ExternalWorkerJobAcquireBuilder`
  `tenantId(String tenantId)`
  Acquire only jobs which are within the given tenant.
  `ExternalWorkerJobAcquireBuilder`
  `topic(String topic, Duration lockDuration)`
  The topic and lock duration for the requested jobs

- ## Method Details

  - ### topic

    ExternalWorkerJobAcquireBuilder topic(String topic, Duration lockDuration)
    The topic and lock duration for the requested jobs
    Parameters:
      `topic` - the topic of the jobs
      `lockDuration` - the duration for locking the jobs

  - ### onlyBpmn

    ExternalWorkerJobAcquireBuilder onlyBpmn()
    Acquire only jobs which are linked to a process instance. Cannot be combined with `onlyCmmn()` and `scopeType(String)`

  - ### onlyCmmn

    ExternalWorkerJobAcquireBuilder onlyCmmn()
    Acquire only jobs which are linked to a case instance. Cannot be combined with `onlyBpmn()` and `scopeType(String)`

  - ### scopeType

    ExternalWorkerJobAcquireBuilder scopeType(String scopeType)
    Acquire only jobs which are linked to the given scope type. Cannot be combined with `onlyBpmn()` or `onlyCmmn()`

  - ### tenantId

    ExternalWorkerJobAcquireBuilder tenantId(String tenantId)
    Acquire only jobs which are within the given tenant.

  - ### forUserOrGroups

    ExternalWorkerJobAcquireBuilder forUserOrGroups(String userId, Collection<String> groups)
    Acquire only jobs where the given user or groups are authorized to execute.

  - ### acquireAndLock

    default List<AcquiredExternalWorkerJob> acquireAndLock(int numberOfTasks, String workerId)
    Acquire and lock the given number of jobs for the given worker id. By default it will try to acquire jobs 5 times. Use `acquireAndLock(int, String, int)` if you need more retries. If it fails to lock the jobs / scope after 5 retries it will return an empty list
    Parameters:
      `numberOfTasks` - the number of jobs to acquire
      `workerId` - the id of the worker acquiring the jobs

  - ### acquireAndLock

    List<AcquiredExternalWorkerJob> acquireAndLock(int numberOfTasks, String workerId, int numberOfRetries)
    Acquire and lock the given number of jobs for the given worker id. If it fails to lock the jobs / scope after `numberOfRetries` it will return an empty list
    Parameters:
      `numberOfTasks` - the number of jobs to acquire
      `workerId` - the id of the worker acquiring the jobs
      `numberOfRetries` - the number of retries if an optimistic lock exception occurs during acquiring