oscerd commented on code in PR #26779:
URL: https://github.com/apache/camel/pull/26779#discussion_r4084256876
##########
components/camel-pulsar/src/main/java/org/apache/camel/component/pulsar/PulsarMessageListener.java:
##########
@@ -73,4 +73,15 @@ private void acknowledge(final Consumer<byte[]> consumer,
final Message<byte[]>
}
}
+ /**
+ * Tells the broker the message was not processed, so that it is
redelivered after
+ * <tt>negativeAckRedeliveryDelayMicros</tt> instead of waiting for the
acknowledgement timeout. Left to the route
+ * when manual acknowledgement is enabled, the same way {@link
#acknowledge} is.
+ */
+ private void negativeAcknowledge(final Consumer<byte[]> consumer, final
Message<byte[]> message) {
+ if (!endpoint.getPulsarConfiguration().isAllowManualAcknowledgement())
{
+ consumer.negativeAcknowledge(message.getMessageId());
Review Comment:
Applied in a46191 — and you were right for a reason I had not checked.
Disassembling `NegativeAcksTracker` in pulsar-client 4.2.4:
```
add(MessageId) -> add(messageId, 0)
add(Message) -> add(message.getMessageId(), message.getRedeliveryCount())
add(MessageId, int redeliveryCount) ->
negativeAckRedeliveryBackoff.next(redeliveryCount)
```
So with the id overload the backoff is consulted but always asked for the
delay of attempt **zero**, and never escalates. The upgrade guide claim only
holds with the `Message` overload. The test now verifies
`negativeAcknowledge(message)` and asserts the id overload is *not* used, and
reverting to the id overload fails it.
Both optional items are in too: the nack is sent **before** the exception
handler, so a throwing custom handler cannot cost us the nack, and there is a
new test that `allowManualAcknowledgement=true` plus a failed exchange sends
nothing to the broker. Removing the manual-ack guard fails that test.
On the 10 s vs 60 s question — thanks, keeping it as is with the
upgrade-guide note, no opt-in option.
The branch is rebased past the `CatalogDocExamplesTest` breakage, so CI
should be clean now.
_Claude Code on behalf of oscerd_
--
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]