Hi, we're using the Pulsar Client Java. I don't un...
# general
g
Hi, we're using the Pulsar Client Java. I don't understand the difference between : •
consumer.negativeAcknowledge(msg);
•
consumer.reconsumeLater(msg, 1000, TimeUnit.MILLISECONDS);
Is it just the possibility to customize the delay ?
l
technically
reconsumeLater
is very different. It uses DeadLetterPolicy's retryLetterTopic with delayed delivery to handle the delay. The message is resent to the retryLetterTopic. The consumer subscribes also to the retryLetterTopic. The messages are acknowledged in the original input topic. negativeAcknowledgement doesn't resend messages. Instead, it delays the negative acknowledgement on the client side and after a delay (configurable with
negativeAckRedeliveryDelay
and
negativeAckRedeliveryBackoff
defaults to exponential backoff with jitter) until deadLetterPolicy's maxRedeliverCount is reached. When the broker receives the negativeAcknowledgement, it will immediately redeliver the message. Negative acknowledgements is designed to be used only with Shared subscriptions at the moment. When there are multiple active consumers on the shared subscription, the message would get delivered to one of the consumers that has available permits at the moment broker delivers the message.
g
Ok thank you. So the client subscribes to the retryLetterTopic if enableRetry is set ? And using this method, there is no backoff (unless do it manually) ?