Class JobWorkerImpl
- All Implemented Interfaces:
JobWorker
,Closeable
,AutoCloseable
In order to get an initial set of jobs to work on, the job worker will schedule a first poll
on construction. If a poll does not provide any new jobs, another poll is scheduled with a delay
using the pollInterval
.
If a poll successfully provides jobs, the worker submits each job to the job handler. Every
time a job is completed, the worker checks if it still has enough jobs to work on. If not, it
will poll for new jobs. To determine what is considered enough jobs it compares its number of
remainingJobs
with the activationThreshold
.
If a poll fails with an error response, a retry is scheduled with a delay using the
retryDelaySupplier
to ask for a new pollInterval
. By default, this retry delay supplier
is the ExponentialBackoff
. This default is also used as a fallback for the user provided
backoff. On the next success, the pollInterval
is reset to its original value.
-
Constructor Summary
ConstructorsConstructorDescriptionJobWorkerImpl
(int maxJobsActive, ScheduledExecutorService executor, Duration pollInterval, JobRunnableFactory jobHandlerFactory, JobPoller jobPoller, io.camunda.zeebe.client.impl.worker.JobStreamer jobStreamer, BackoffSupplier backoffSupplier, JobWorkerMetrics metrics) -
Method Summary
-
Constructor Details
-
JobWorkerImpl
public JobWorkerImpl(int maxJobsActive, ScheduledExecutorService executor, Duration pollInterval, JobRunnableFactory jobHandlerFactory, JobPoller jobPoller, io.camunda.zeebe.client.impl.worker.JobStreamer jobStreamer, BackoffSupplier backoffSupplier, JobWorkerMetrics metrics)
-
-
Method Details
-
isOpen
public boolean isOpen() -
isClosed
public boolean isClosed() -
close
public void close()Description copied from interface:JobWorker
Closes this registration and stops receiving new work items. Blocks until all previously received items have been handed to the worker.
-