jeffgrunewald commented on a change in pull request #6680: [Issue 
5979][pulsar-websocket] Add cumulative acknowledgement to websocket consumer
URL: https://github.com/apache/pulsar/pull/6680#discussion_r406775485
 
 

 ##########
 File path: 
pulsar-websocket/src/main/java/org/apache/pulsar/websocket/ConsumerHandler.java
 ##########
 @@ -240,12 +242,27 @@ public void onWebSocketText(String message) {
                 // We should have received an ack
                 MessageId msgId = 
MessageId.fromByteArrayWithTopic(Base64.getDecoder().decode(command.messageId),
                         topic.toString());
-                consumer.acknowledgeAsync(msgId).thenAccept(consumer -> 
numMsgsAcked.increment());
-                if (!this.pullMode) {
-                    int pending = pendingMessages.getAndDecrement();
-                    if (pending >= maxPendingMessages) {
-                        // Resume delivery
-                        receiveMessage();
+                if ("cumulative".equals(command.ackType)) {
+                    ConsumerStats cStats = consumer.getStats();
+                    long ackDiff = cStats.getTotalMsgsReceived() - 
cStats.getTotalAcksSent();
 
 Review comment:
   Can you recommend a different interface for getting the current offset based 
on a message ID? If I have that, then I can still calculate the difference for 
the number of messages acked by the consumer and update the value.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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

Reply via email to