merlimat opened a new pull request, #25649:
URL: https://github.com/apache/pulsar/pull/25649
## Summary
Replace the V5 `QueueConsumerBuilder` `ackTimeout(Duration)` /
`ackTimeoutRedeliveryBackoff(BackoffPolicy)` pair with a single
`processingTimeout(ProcessingTimeoutPolicy)` method.
The new name reflects the intent: it's a safety net for slow / stalled
consumers (\"the application didn't process and ack in time\"), not a
property
of the ack itself. The new policy record bundles the two related knobs — the
timeout and the optional redelivery backoff — into a single argument so users
configure them together.
## API
```java
QueueConsumerBuilder<T> processingTimeout(ProcessingTimeoutPolicy policy);
```
`ProcessingTimeoutPolicy` (new, in `org.apache.pulsar.client.api.v5.config`,
record-shaped like `DeadLetterPolicy` / `EncryptionPolicy`):
```java
public record ProcessingTimeoutPolicy(
Duration timeout,
BackoffPolicy redeliveryBackoff // nullable
) {
public static ProcessingTimeoutPolicy of(Duration timeout);
public static ProcessingTimeoutPolicy of(Duration timeout, BackoffPolicy
redeliveryBackoff);
}
```
The redelivery itself is client-triggered: the V5 client tracks pending acks
and, on timeout, sends `redeliverUnacknowledgedMessages` to the broker. The
policy javadoc spells this out so users understand where the bookkeeping
lives.
## Implementation
The `QueueConsumerBuilderV5` impl wires `policy.timeout()` into
`setAckTimeoutMillis` and `policy.redeliveryBackoff()` (when non-null) into
`setAckTimeoutRedeliveryBackoff`. Broker side is untouched.
## Tests
- `V5AckTimeoutTest` renamed to `V5ProcessingTimeoutTest`; method renamed
`testUnackedMessageIsRedeliveredAfterAckTimeout` →
`testUnackedMessageIsRedeliveredAfterProcessingTimeout`. Test now uses
`.processingTimeout(ProcessingTimeoutPolicy.of(Duration.ofSeconds(1)))`.
### Matching PR(s) in forked repositories
- area/client
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]