OptionalbacklogRetry a backlog activation (the initial backfill, a reconnect backfill,
or a sidecar poll) that fails with a transient error
(RESOURCE_EXHAUSTED, UNAVAILABLE, DEADLINE_EXCEEDED). Defaults to
exponential backoff from 50ms by a factor of 1.6, capped at 5000ms,
with full jitter — each delay is a uniform random value in [0, cap],
so a fleet that is throttled together does not retry in lockstep.
Pass false to restore the old behaviour (no retry), or an object to
tune the retry. With false, a failed initial startup backfill rejects
streamJobs() before recurring polling is scheduled; a later failed
activation is recovered by the next sidecar poll only when recurring
polling is enabled (pollInterval > 0). jitter is the
jitter width as a fraction of the capped base delay: 1 (the default)
is full jitter [0, cap], 0.1 is ±10% around the base, 0 disables
jitter. random is a random source returning [0, 1); inject a
deterministic one in tests.
OptionalonCalled when the server ends or closes the job stream without an error. Exceptions thrown by the callback, and rejections of a returned promise, are caught and logged.
OptionalonCalled when the job stream fails: a stream error event, or a failed
attempt to open the stream. Exceptions thrown by the callback, and
rejections of a returned promise, are caught and logged.
OptionalonCalled just before each attempt to re-open a dead stream. attempt is
the number of consecutive failed streams or open attempts, starting at 1.
It resets once a re-opened stream delivers a job or stays up for at least
maxDelayMs. Exceptions thrown by the callback, and rejections of a
returned promise, are caught and logged.
OptionalstreamInactivity watchdog, in milliseconds. If no job arrives on the stream for this long, the stream is cancelled and recreated. The timer resets on every received job. This catches silent stalls where the transport is healthy (HTTP/2 keepalive passes) but the stream no longer delivers jobs — for example a proxy keeping the socket warm after the broker-side handler stopped pushing.
Defaults to 10 minutes (600_000), the Camunda Java client's
streamInactivityTimeout default. Pass false to disable the watchdog.
It must be less than streamTimeout (a watchdog that cannot fire before
the stream is recycled anyway is useless): when it is not, it is clamped
to 90% of the configured streamTimeout and a warning is logged. Each
stream's deadline is jittered the same way as streamTimeout: a uniform
random value in [0.9 × streamInactivityTimeout, streamInactivityTimeout].
random is a random source returning [0, 1) (like Math.random);
inject a deterministic one in tests.
OptionalstreamBack off the recurring sidecar poll while it keeps returning no jobs
and the stream is open, like the Camunda Java client's
streamNoJobsBackoffSupplier. Each empty poll schedules the next one
after min(current * factor, maxDelayMs), jittered by ±jitter
(a fraction of the delay); a poll that activates at least one job, or a
poll while the stream is down, resets the delay to pollInterval.
Defaults match the Java client: factor 1.6, jitter 0.1, max 60000ms.
Pass false to poll at a fixed pollInterval. random is a random
source returning [0, 1); inject a deterministic one in tests.
OptionalstreamRe-open the stream when it dies. Defaults to true, with exponential
backoff starting at 1000ms, capped at 30000ms, and full jitter applied
(each delay is a uniform random value in [0, cap], so a fleet of
workers whose streams die together does not reconnect in lockstep).
Pass false to disable reconnection (the onStream* callbacks still
fire), or an object to tune the backoff. random is a random source
returning [0, 1) (like Math.random); inject a deterministic one in
tests. After a re-opened stream is established, one backfill poll runs
to pick up jobs that were created while the stream was down.
OptionalstreamMaximum lifetime of one job stream, in milliseconds. When it is reached the stream is recycled: a replacement stream is opened first, and only then is the old stream cancelled, so no job is dropped in the gap.
A job stream is one long-lived gRPC call pinned to the gateway it first reached. Without a maximum lifetime, streams never move after a gateway scale-out or restart: new gateways get no streams and the survivors stay overloaded until the worker processes restart. Recycling spreads the streams back across the gateways — provided the load balancer routes each new stream independently (see the README's Job Streaming section: this needs request-level/L7 balancing; a plain L4 balancer reuses the same HTTP/2 connection and needs DNS or client-side balancing instead).
Defaults to 8 hours (28_800_000), the Camunda Java client's
streamTimeout default. Pass false to disable recycling. Each stream's
deadline is jittered: a uniform random value in [0.9 × streamTimeout, streamTimeout], so a fleet that started together does not recycle every
stream in the same second every 8 hours. random is a random source
returning [0, 1) (like Math.random); inject a deterministic one in
tests.
Options controlling how
streamJobsreports and recovers from a job stream that dies (stream error, server-side end/close, or a failed open).