DanielWang2035 commented on code in PR #17238:
URL: https://github.com/apache/iotdb/pull/17238#discussion_r3246263985


##########
iotdb-client/subscription/src/main/java/org/apache/iotdb/session/subscription/consumer/base/AbstractSubscriptionPullConsumer.java:
##########
@@ -135,6 +141,24 @@ public synchronized void close() {
       return;
     }
 
+    // flush all processors and commit any remaining buffered messages
+    if (!processors.isEmpty()) {
+      final List<SubscriptionMessage> flushed = new ArrayList<>();
+      for (final SubscriptionMessageProcessor processor : processors) {
+        final List<SubscriptionMessage> out = processor.flush();
+        if (out != null) {
+          flushed.addAll(out);
+        }
+      }
+      if (!flushed.isEmpty() && autoCommit) {

Review Comment:
   Fixed. Manual-commit close no longer silently drops messages flushed from 
processors. The consumer now drains buffered processor output, preserves 
user-visible drained messages, and rejects close with a clear exception until 
the application drains/commits them explicitly.



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to