BewareMyPower commented on a change in pull request #7823:
URL: https://github.com/apache/pulsar/pull/7823#discussion_r471320837
##########
File path:
pulsar-client/src/main/java/org/apache/pulsar/client/impl/MultiTopicsConsumerImpl.java
##########
@@ -720,16 +720,36 @@ private void
removeExpiredMessagesFromQueue(Set<MessageId> messageIds) {
}
}
- private boolean topicNameValid(String topicName) {
- return TopicName.isValid(topicName) && !topics.containsKey(topicName);
+ private TopicName getTopicName(String topic) {
+ try {
+ return TopicName.get(topic);
+ } catch (Exception ignored) {
+ return null;
+ }
+ }
+
+ private String getFullTopicName(String topic) {
+ TopicName topicName = getTopicName(topic);
+ return (topicName != null) ? topicName.toString() : null;
+ }
+
+ private void removeTopic(String topic) {
+ String fullTopicName = getFullTopicName(topic);
+ if (fullTopicName != null) {
+ topics.remove(topic);
+ }
}
// subscribe one more given topic
public CompletableFuture<Void> subscribeAsync(String topicName, boolean
createTopicIfDoesNotExist) {
- if (!topicNameValid(topicName)) {
+ TopicName topicNameInstance = getTopicName(topicName);
Review comment:
@codelipenghui Sorry I haven't noticed the later part of your review
before. I didn't change the original behavior in this PR because it needs
relative changes with unit tests. I'll do it soon.
----------------------------------------------------------------
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]