viktorsomogyi commented on code in PR #18994:
URL: https://github.com/apache/kafka/pull/18994#discussion_r1983294028


##########
connect/mirror/src/main/java/org/apache/kafka/connect/mirror/MirrorMaker.java:
##########
@@ -291,6 +296,18 @@ private static String encodePath(String rawPath) throws 
UnsupportedEncodingExcep
                 .replaceAll("\\+", "%20");
     }
 
+    private String generateWorkerId(SourceAndTarget sourceAndTarget) {
+        if (config.enableInternalRest()) {
+            return advertisedUrl.getHost() + ":" + advertisedUrl.getPort() + 
"/" + sourceAndTarget.toString();
+        }
+        try {
+            //UUID to make sure it is unique even if multiple workers running 
on the same host
+            return InetAddress.getLocalHost().getHostName() + "/" + 
sourceAndTarget.toString() + "/" + UUID.randomUUID();

Review Comment:
   Why localhost? Wouldn't it be better to return the canonical hostname?



-- 
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: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to