pulsar-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] jerrypeng commented on a change in pull request #3703: Added support for "negative acks" in Java client
Date Wed, 27 Feb 2019 18:48:30 GMT
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_r260890787
 
 

 ##########
 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&lt;String&gt; 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:
   never mind it seems that "NACKs" seems like the official terminology for this situation

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message