jerrypeng commented on a change in pull request #3703: Added support for
"negative acks" in Java client
URL: https://github.com/apache/pulsar/pull/3703#discussion_r260888244
##########
File path:
pulsar-client-api/src/main/java/org/apache/pulsar/client/api/Consumer.java
##########
@@ -129,6 +129,57 @@
*/
void acknowledge(MessageId messageId) throws PulsarClientException;
+ /**
+ * Acknowledge the failure to process a single message.
+ * <p>
+ * When a message is "negatively acked" it will be marked for redelivery
after
+ * some fixed delay. The delay is configurable when constructing the
consumer
+ * with {@link ConsumerBuilder#negativeAckRedeliveryDelay(long, TimeUnit)}.
+ * <p>
+ * This call is not blocking.
+ *
+ * <p>
+ * Example of usage:
+ * <pre><code>
+ * while (true) {
+ * Message<String> msg = consumer.receive();
+ *
+ * try {
+ * // Process message...
+ *
+ * consumer.acknowledge(msg);
+ * } catch (Throwable t) {
+ * log.warn("Failed to process message");
+ * consumer.negativeAcknowledge(msg);
+ * }
+ * }
+ * </code></pre>
+ *
+ * @param message
+ * The {@code Message} to be acknowledged
+ */
+ void negativeAcknowledge(Message<?> message);
Review comment:
should we name the API "fail"?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services