You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by xy...@apache.org on 2025/04/28 03:20:46 UTC
(pulsar-client-cpp) 03/05: Fix multi-topics-consumer new topic listeners stuck in paused state (#481)
This is an automated email from the ASF dual-hosted git repository.
xyz pushed a commit to branch branch-3.7
in repository https://gitbox.apache.org/repos/asf/pulsar-client-cpp.git
commit 7f85d53e21c8dc3534e6fa5d9246b41bd78f7dfa
Author: Brett <38...@users.noreply.github.com>
AuthorDate: Tue Apr 22 01:45:54 2025 -0500
Fix multi-topics-consumer new topic listeners stuck in paused state (#481)
This was introduced in v3.7.0 via #447, which contained a change that attempted to fix an issue where a pre-mature ack of a message before a multi-topic subscriber was ready could have caused a crash. To fix the original bug, all multi-topic subscriptions are started with their message listener paused. They later get un-paused once all topics are successfully subscribed and connected. However, on a regex subscription when new topics are discovered, they also start in a paused state, [...]
This change adds a call to resume any new listeners after new topics are added.
(cherry picked from commit 0a9b7d9e7b5c8e2ddb111c30d242793217c68c65)
---
lib/PatternMultiTopicsConsumerImpl.cc | 3 +++
1 file changed, 3 insertions(+)
diff --git a/lib/PatternMultiTopicsConsumerImpl.cc b/lib/PatternMultiTopicsConsumerImpl.cc
index 4fc7bb6..73aa874 100644
--- a/lib/PatternMultiTopicsConsumerImpl.cc
+++ b/lib/PatternMultiTopicsConsumerImpl.cc
@@ -118,6 +118,9 @@ void PatternMultiTopicsConsumerImpl::timerGetTopicsOfNamespace(const Result resu
// callback method when added topics all subscribed.
ResultCallback topicsAddedCallback = [this, topicsRemoved, topicsRemovedCallback](Result result) {
if (result == ResultOk) {
+ if (messageListener_) {
+ resumeMessageListener();
+ }
// call to unsubscribe all removed topics.
onTopicsRemoved(topicsRemoved, topicsRemovedCallback);
} else {