GitHub user drriguz added a comment to the discussion: negativeAcknowledge() 
parameter does not take effect

I'm also confused about this, I found that messages are not redelivered in my 
application by using the following code:
```java
try {
            MetaDataChangedEvent<?> message = 
messageDecoder.decodeEvent(msg.getData());
            if (message instanceof AppDescriptionChanged) {
                messageProcessService.processEvent((AppDescriptionChanged) 
message);
            } else {
                messageProcessService.processEvent((SnapshotEvent<?>) message);
            }
            consumer.acknowledge(msg);
        } catch (InterruptedException e) {
            Thread.currentThread().interrupt();
            logger.error("Failed to process message {}: interrupted", 
msg.getMessageId(), e);
            consumer.negativeAcknowledge(msg);
        } catch (Exception e) {
            // todo: error handling & impl retry strategy
            logger.error("Failed to process message {}", msg.getMessageId(), e);
            consumer.negativeAcknowledge(msg);
        }
```

The document does not say clearly about that, and there's also someone asking 
in Stackoverflow: 
https://stackoverflow.com/questions/69590720/pulsar-if-a-message-gets-nackd-negativeacknowledge-when-will-it-be-redeliv

And also, the document mentioned that automatic retry is disabled by default, 
is this the reason that negative-acked messages are not redelivered?

> By default, automatic retry is disabled. You can set enableRetry to true to 
> enable automatic retry on the consumer.

GitHub link: 
https://github.com/apache/pulsar/discussions/18857#discussioncomment-4352725

----
This is an automatically sent email for dev@pulsar.apache.org.
To unsubscribe, please send an email to: dev-unsubscr...@pulsar.apache.org

Reply via email to