You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2018/07/13 14:00:59 UTC
[GitHub] merlimat commented on a change in pull request #2135: Allow user to
get topic from consumer message (#2007)
merlimat commented on a change in pull request #2135: Allow user to get topic from consumer message (#2007)
URL: https://github.com/apache/incubator-pulsar/pull/2135#discussion_r202359227
##########
File path: pulsar-common/src/main/java/org/apache/pulsar/common/naming/TopicName.java
##########
@@ -333,6 +333,18 @@ public String getSchemaName() {
+ "/" + getLocalName();
}
+ /**
+ * Get the full name for the topic.
+ * E.g. persistent://public/default/topic1
+ */
+ public String getFullName() {
+ if (isV2()) {
+ return String.format("%s://%s/%s/%s", domain, tenant, namespacePortion, getEncodedLocalName());
+ } else {
+ return String.format("%s://%s/%s/%s/%s", domain, tenant, cluster, namespacePortion, getEncodedLocalName());
+ }
+ }
Review comment:
@ivankelly To have a more consistent behavior across the codebase, I would suggest to have the "full-name" always returned by the `toString()` method.
Currently we use the `completeTopicName`, but that was the string that we got and parsed.
Since the `TopicName` instances are cached automatically, I think we should initialize `completeTopicName` with `getFullName()` which could be a private method.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services