BewareMyPower commented on a change in pull request #7823:
URL: https://github.com/apache/pulsar/pull/7823#discussion_r471197959
##########
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);
+ }
Review comment:
`getTopicName` and `getFullTopicName` are just for ignoring the
exceptions because we will throw a `PulsarClientException` later. `removeTopic`
is to ensure that the key to remove is a full topic name.
----------------------------------------------------------------
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]