pulsar-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] jiazhai commented on a change in pull request #2400: Dead Letter Topic
Date Mon, 20 Aug 2018 09:08:57 GMT
jiazhai commented on a change in pull request #2400: Dead Letter Topic
URL: https://github.com/apache/incubator-pulsar/pull/2400#discussion_r211190516
 
 

 ##########
 File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentDispatcherMultipleConsumers.java
 ##########
 @@ -556,13 +618,90 @@ public synchronized void redeliverUnacknowledgedMessages(Consumer consumer)
{
 
     @Override
     public synchronized void redeliverUnacknowledgedMessages(Consumer consumer, List<PositionImpl>
positions) {
-        positions.forEach(position -> messagesToReplay.add(position.getLedgerId(), position.getEntryId()));
         if (log.isDebugEnabled()) {
             log.debug("[{}-{}] Redelivering unacknowledged messages for consumer {}", name,
consumer, positions);
         }
+        if (maxRedeliveryCount > 0 && redeliveryTracker != null) {
+            for (PositionImpl position : positions) {
+                if (redeliveryTracker.incrementAndGetRedeliveryCount(position) <= maxRedeliveryCount)
{
+                    messagesToReplay.add(position.getLedgerId(), position.getEntryId());
+                } else {
+                    messagesToDeadLetter.add(position);
+                }
+            }
+            if (messagesToDeadLetter.size() > 0) {
+                CountDownLatch latch = new CountDownLatch(messagesToDeadLetter.size());
+                for (PositionImpl position : messagesToDeadLetter) {
+                    cursor.asyncReadEntry(position, new AsyncCallbacks.ReadEntryCallback()
{
 
 Review comment:
   ReadEntries would reduce the calling between broker and bookie.

----------------------------------------------------------------
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