Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ public void addPartialSubscription(String clientId, String group, String topic,
if (!liteLifecycleManager.isSubscriptionActive(topic, lmqName)) {
continue;
}
if (!isLiteTopicSubscribed(clientGroup, lmqName) && getActiveSubscriptionNum() >= maxCount) {
throw new LiteQuotaException("lite subscription quota exceeded " + maxCount);
}
thisSub.addLiteTopic(lmqName);
// First remove the old subscription
if (LiteMetadataUtil.isSubLiteExclusive(group, brokerController)) {
Expand Down Expand Up @@ -147,6 +150,10 @@ public void addCompleteSubscription(String clientId, String group, String topic,
removeTopicGroup(clientGroup, lmqName, false);
});
lmqNameNew.forEach(lmqName -> {
long maxCount = brokerController.getBrokerConfig().getMaxLiteSubscriptionCount();
if (!isLiteTopicSubscribed(clientGroup, lmqName) && getActiveSubscriptionNum() >= maxCount) {
throw new LiteQuotaException("lite subscription quota exceeded " + maxCount);
}
thisSub.addLiteTopic(lmqName);
addTopicGroup(clientGroup, lmqName);
});
Expand Down Expand Up @@ -269,6 +276,11 @@ public void cleanSubscription(String lmqName, boolean notifyClient) {
}
}

protected boolean isLiteTopicSubscribed(ClientGroup clientGroup, String lmqName) {
Set<ClientGroup> topicGroupSet = liteTopic2Group.get(lmqName);
return topicGroupSet != null && topicGroupSet.contains(clientGroup);
}

protected void addTopicGroup(ClientGroup clientGroup, String lmqName) {
Set<ClientGroup> topicGroupSet = liteTopic2Group
.computeIfAbsent(lmqName, k -> ConcurrentHashMap.newKeySet());
Expand Down