Annotation Interface JobWorker


@Target(METHOD) @Retention(RUNTIME) @Documented public @interface JobWorker
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    boolean
    If set to true, the job is automatically completed after the worker code has finished.
    boolean
     
    boolean
    If set to true, all variables are fetched
    Set a list of variable names which should be fetch on job activation.
    int
    Set the maximum number of jobs which will be exclusively activated for this worker at the same time.
    int
    Set the max number of retries for a job
    set to empty string which leads to default from ZeebeClientBuilderImpl being used in ZeebeWorkerAnnotationProcessor
    long
    Set the maximal interval (in milliseconds) between polling for new jobs.
    long
    Set the request timeout (in seconds) for activate job request used to poll for new job.
    boolean
     
    long
    Stream timeout in ms
     
    long
    Set the time (in milliseconds) for how long a job is exclusively assigned for this worker.
    Set to empty string which leads to method name being used (if not ${zeebe.client.worker.default-type} is configured) Implemented in ZeebeWorkerAnnotationProcessor
  • Element Details

    • type

      String type
      Set to empty string which leads to method name being used (if not ${zeebe.client.worker.default-type} is configured) Implemented in ZeebeWorkerAnnotationProcessor
      Default:
      ""
    • name

      String name
      set to empty string which leads to default from ZeebeClientBuilderImpl being used in ZeebeWorkerAnnotationProcessor
      Default:
      ""
    • timeout

      long timeout
      Set the time (in milliseconds) for how long a job is exclusively assigned for this worker. In this time, the job can not be assigned by other workers to ensure that only one worker work on the job. When the time is over then the job can be assigned again by this or other worker if it's not completed yet. If no timeout is set, then the default is used from the configuration.
      Default:
      -1L
    • maxJobsActive

      int maxJobsActive
      Set the maximum number of jobs which will be exclusively activated for this worker at the same time. This is used to control the backpressure of the worker. When the maximum is reached then the worker will stop activating new jobs in order to not overwhelm the client and give other workers the chance to work on the jobs. The worker will try to activate new jobs again when jobs are completed (or marked as failed). If no maximum is set then the default, from the ZeebeClientConfigurationImpl, is used.

      Considerations: A greater value can avoid situations in which the client waits idle for the broker to provide more jobs. This can improve the worker's throughput. The memory used by the worker is linear with respect to this value. The job's timeout starts to run down as soon as the broker pushes the job. Keep in mind that the following must hold to ensure fluent job handling:
      time spent in queue + time job handler needs until job completion invalid input: '<' job timeout
      Default:
      -1
    • requestTimeout

      long requestTimeout
      Set the request timeout (in seconds) for activate job request used to poll for new job. If no request timeout is set then the default is used from the ZeebeClientConfigurationImpl
      Default:
      -1L
    • pollInterval

      long pollInterval
      Set the maximal interval (in milliseconds) between polling for new jobs. A job worker will automatically try to always activate new jobs after completing jobs. If no jobs can be activated after completing the worker will periodically poll for new jobs. If no poll interval is set then the default is used from the ZeebeClientConfiguration
      Default:
      -1L
    • fetchVariables

      String[] fetchVariables
      Set a list of variable names which should be fetch on job activation. The jobs which are activated by this worker will only contain variables from this list. This can be used to limit the number of variables of the activated jobs.
      Default:
      {}
    • fetchAllVariables

      boolean fetchAllVariables
      If set to true, all variables are fetched
      Default:
      false
    • autoComplete

      boolean autoComplete
      If set to true, the job is automatically completed after the worker code has finished. In this case, your worker code is not allowed to complete the job itself.

      You can still throw exceptions if you want to raise a problem instead of job completion. You could also raise a BPMN problem throwing a ZeebeBpmnError

      Default:
      true
    • enabled

      boolean enabled
      Default:
      true
    • tenantIds

      String[] tenantIds
      Default:
      {}
    • streamEnabled

      boolean streamEnabled
      Default:
      true
    • streamTimeout

      long streamTimeout
      Stream timeout in ms
      Default:
      3600000L
    • maxRetries

      int maxRetries
      Set the max number of retries for a job
      Default:
      -1