heesung-sn commented on code in PR #402:
URL: https://github.com/apache/pulsar-client-cpp/pull/402#discussion_r1493810369


##########
lib/ClientConnection.cc:
##########
@@ -1761,6 +1766,55 @@ void ClientConnection::handleError(const 
proto::CommandError& error) {
     }
 }
 
+std::string ClientConnection::getMigratedBrokerServiceUrl(
+    const proto::CommandTopicMigrated& commandTopicMigrated) {
+    if (tlsSocket_) {
+        if (commandTopicMigrated.has_brokerserviceurltls()) {
+            return commandTopicMigrated.brokerserviceurltls();
+        }
+    } else if (commandTopicMigrated.has_brokerserviceurl()) {
+        return commandTopicMigrated.brokerserviceurl();
+    }
+    return "";
+}
+
+void ClientConnection::handleTopicMigrated(const proto::CommandTopicMigrated& 
commandTopicMigrated) {
+    const long resourceId = commandTopicMigrated.resource_id();
+    const std::string migratedBrokerServiceUrl = 
getMigratedBrokerServiceUrl(commandTopicMigrated);
+
+    if (migratedBrokerServiceUrl.empty()) {
+        LOG_WARN("Failed to find the migrated broker url for resource:"
+                 << resourceId
+                 << (commandTopicMigrated.has_brokerserviceurl()
+                         ? ", migratedBrokerUrl: " + 
commandTopicMigrated.brokerserviceurl()
+                         : "")
+                 << (commandTopicMigrated.has_brokerserviceurltls()
+                         ? ", migratedBrokerUrlTls: " + 
commandTopicMigrated.brokerserviceurltls()
+                         : ""));
+        return;
+    }
+
+    if (commandTopicMigrated.resource_type() == 
proto::CommandTopicMigrated_ResourceType_Producer) {
+        auto it = producers_.find(resourceId);

Review Comment:
   nit: I see SynchronizedHashMap for the other producer and consumer maps in 
ClientImpl.h. Why are these not SynchronizedHashMap?



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to