Class ProcessingTimeoutPolicy
java.lang.Object
org.apache.pulsar.client.api.v5.config.ProcessingTimeoutPolicy
Optional safety net for slow / stalled queue consumers: if the application doesn't
process and acknowledge a delivered message within
timeout, the client
gives up on that delivery and asks the broker to redeliver it (to this consumer or,
on a Shared subscription, to another consumer in the group). The bookkeeping is
client-side — the client tracks pending acks and, on timeout, sends a
redeliverUnacknowledgedMessages request to the broker.
redeliveryBackoff controls the cadence of those redeliveries — null
means "redeliver immediately on the next sweep", which is the historical default.
Disabled by default. Pass to
QueueConsumerBuilder.processingTimeout(ProcessingTimeoutPolicy)
when the application's processing time is bounded and you want stalled deliveries to
be reattempted automatically.
Use of(Duration) for the common case (no extra backoff), or
builder() to also configure redeliveryBackoff.
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionbuilder()static ProcessingTimeoutPolicyCreate a policy with just a timeout — the broker uses its default redelivery cadence (no extra backoff between retries).timeout()
-
Method Details
-
timeout
- Returns:
- how long the client waits for the application to ack a delivery before
requesting redelivery;
Duration.ZEROdisables
-
redeliveryBackoff
- Returns:
- optional backoff applied between redeliveries, or
nullfor the default (no extra delay)
-
of
Create a policy with just a timeout — the broker uses its default redelivery cadence (no extra backoff between retries).- Parameters:
timeout- the processing-timeout duration- Returns:
- a
ProcessingTimeoutPolicywith no extra redelivery backoff
-
builder
- Returns:
- a new builder for constructing a
ProcessingTimeoutPolicy
-