Interface JobWorkerBuilderStep1.JobWorkerBuilderStep3

    • Method Detail

      • timeout

        JobWorkerBuilderStep1.JobWorkerBuilderStep3 timeout​(long timeout)
        Set the time 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.

        Parameters:
        timeout - the time in milliseconds
        Returns:
        the builder for this worker
      • timeout

        JobWorkerBuilderStep1.JobWorkerBuilderStep3 timeout​(Duration timeout)
        Set the time 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 time is set then the default is used from the configuration.

        Parameters:
        timeout - the time as duration (e.g. "Duration.ofMinutes(5)")
        Returns:
        the builder for this worker
      • name

        JobWorkerBuilderStep1.JobWorkerBuilderStep3 name​(String workerName)
        Set the name of the worker owner.

        This name is used to identify the worker to which a job is exclusively assigned to.

        If no name is set then the default is used from the configuration.

        Parameters:
        workerName - the name of the worker (e.g. "payment-service")
        Returns:
        the builder for this worker
      • maxJobsActive

        JobWorkerBuilderStep1.JobWorkerBuilderStep3 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 ZeebeClientConfiguration, 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 < job timeout
        Parameters:
        maxJobsActive - the maximum jobs active by this worker
        Returns:
        the builder for this worker
      • pollInterval

        JobWorkerBuilderStep1.JobWorkerBuilderStep3 pollInterval​(Duration pollInterval)
        Set the maximal interval 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

        Parameters:
        pollInterval - the maximal interval to check for new jobs
        Returns:
        the builder for this worker
      • requestTimeout

        JobWorkerBuilderStep1.JobWorkerBuilderStep3 requestTimeout​(Duration requestTimeout)
        Set the request timeout for activate job request used to poll for new job.

        If no request timeout is set then the default is used from the ZeebeClientConfiguration

        Parameters:
        requestTimeout - the request timeout for activate jobs request
        Returns:
        the builder for this worker
      • fetchVariables

        JobWorkerBuilderStep1.JobWorkerBuilderStep3 fetchVariables​(List<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.

        Parameters:
        fetchVariables - list of variables names to fetch on activation
        Returns:
        the builder for this worker
      • fetchVariables

        JobWorkerBuilderStep1.JobWorkerBuilderStep3 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.

        Parameters:
        fetchVariables - list of variables names to fetch on activation
        Returns:
        the builder for this worker
      • open

        JobWorker open()
        Open the worker and start to work on available tasks.
        Returns:
        the worker