You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by te...@apache.org on 2023/07/03 11:34:34 UTC
[pulsar] branch branch-3.0 updated: [fix][broker] Topic policy can not be work well if replay policy message has any exception. (#20613)
This is an automated email from the ASF dual-hosted git repository.
technoboy pushed a commit to branch branch-3.0
in repository https://gitbox.apache.org/repos/asf/pulsar.git
The following commit(s) were added to refs/heads/branch-3.0 by this push:
new 8f5aa1e236b [fix][broker] Topic policy can not be work well if replay policy message has any exception. (#20613)
8f5aa1e236b is described below
commit 8f5aa1e236b80b3e3ebdcca41c5bb051a0d58b8d
Author: Hao Zhang <zh...@cmss.chinamobile.com>
AuthorDate: Fri Jun 30 12:28:32 2023 +0800
[fix][broker] Topic policy can not be work well if replay policy message has any exception. (#20613)
---
.../service/SystemTopicBasedTopicPoliciesService.java | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/SystemTopicBasedTopicPoliciesService.java b/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/SystemTopicBasedTopicPoliciesService.java
index 9b10055f36f..90c1705d361 100644
--- a/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/SystemTopicBasedTopicPoliciesService.java
+++ b/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/SystemTopicBasedTopicPoliciesService.java
@@ -180,7 +180,11 @@ public class SystemTopicBasedTopicPoliciesService implements TopicPoliciesServic
TopicName topicName = TopicName.get(TopicName.get(msg.getKey()).getPartitionedTopicName());
if (listeners.get(topicName) != null) {
for (TopicPolicyListener<TopicPolicies> listener : listeners.get(topicName)) {
- listener.onUpdate(null);
+ try {
+ listener.onUpdate(null);
+ } catch (Throwable error) {
+ log.error("[{}] call listener error.", topicName, error);
+ }
}
}
return;
@@ -195,7 +199,11 @@ public class SystemTopicBasedTopicPoliciesService implements TopicPoliciesServic
if (listeners.get(topicName) != null) {
TopicPolicies policies = event.getPolicies();
for (TopicPolicyListener<TopicPolicies> listener : listeners.get(topicName)) {
- listener.onUpdate(policies);
+ try {
+ listener.onUpdate(policies);
+ } catch (Throwable error) {
+ log.error("[{}] call listener error.", topicName, error);
+ }
}
}
}
@@ -365,7 +373,11 @@ public class SystemTopicBasedTopicPoliciesService implements TopicPoliciesServic
policiesCache.forEach(((topicName, topicPolicies) -> {
if (listeners.get(topicName) != null) {
for (TopicPolicyListener<TopicPolicies> listener : listeners.get(topicName)) {
- listener.onUpdate(topicPolicies);
+ try {
+ listener.onUpdate(topicPolicies);
+ } catch (Throwable error) {
+ log.error("[{}] call listener error.", topicName, error);
+ }
}
}
}));