merlimat commented on a change in pull request #1564: Support short topic name 
in cpp client
URL: https://github.com/apache/incubator-pulsar/pull/1564#discussion_r181236296
 
 

 ##########
 File path: pulsar-client-cpp/lib/TopicName.cc
 ##########
 @@ -52,8 +52,19 @@ TopicName::TopicName() {}
 bool TopicName::init(const std::string& topicName) {
     topicName_ = topicName;
     if (topicName.find("://") == std::string::npos) {
-        LOG_ERROR("Topic name is not valid, domain not present - " << 
topicName);
-        return false;
+        std::string topicNameCopy_ = topicName;
+        std::vector<std::string> pathTokens;
+        boost::algorithm::split(pathTokens, topicNameCopy_, 
boost::algorithm::is_any_of("/"));
+        if (pathTokens.size() == 3) {
+          topicName_ = "persistent://" + pathTokens[0] + "/" + pathTokens[1] + 
"/" + pathTokens[2];
 
 Review comment:
   This will probably break the format checker that expects 4 spaces indent

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to