Replies: 4 comments
|
@yebai1105 You can acked the message at A acked message can not be redeliver again |
|
Unacknowledged messages will be redelivered by default. If A acked message can not be redeliver again, what is the role of "negativeAcknowledge"?In what scenarios is the "negativeAcknowledge" parameter used? |
|
I'm also confused about this, I found that messages are not redelivered in my application by using the following code: 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?
|
|
The issue had no activity for 30 days, mark with Stale label. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Expected behavior
message redelivery
Actual behavior
Message cannot be redelivered
Steps to reproduce
producer code:
consumer code:
use "consumer.negativeAcknowledge(msg)" or "consumer.negativeAcknowledge(new MessageIdImpl(x,x,x))" After executing the consumer program, no message redelivery was found
System configuration
Pulsar version: 2.9.2/2.8.2
All reactions