You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by GitBox <gi...@apache.org> on 2022/08/29 03:33:37 UTC

[GitHub] [inlong] baomingyu commented on a diff in pull request #5595: [INLONG-5101][DataProxy] Optimize load balancing for DataProxy

baomingyu commented on code in PR #5595:
URL: https://github.com/apache/inlong/pull/5595#discussion_r956868632


##########
inlong-sdk/dataproxy-sdk/src/main/java/org/apache/inlong/sdk/dataproxy/network/Sender.java:
##########
@@ -228,12 +229,35 @@ private SendResult syncSendInternalMessage(NettyClient client,
      * @param timeUnit
      * @return
      */
+//    @Deprecated
     public SendResult syncSendMessage(EncodeObject encodeObject, String msgUUID,
             long timeout, TimeUnit timeUnit) {
-        metricWorker.recordNumByKey(encodeObject.getMessageId(),
-                encodeObject.getGroupId(), encodeObject.getStreamId(),
+        return syncSendMessage(encodeObject, msgUUID, timeout,
+                timeUnit, ConfigConstants.DEFAULT_LOAD_BALANCE);
+    }
+
+    public SendResult syncSendMessage(EncodeObject encodeObject, String msgUUID, long timeout,
+                                      TimeUnit timeUnit, String loadBalance) {
+        metricWorker.recordNumByKey(encodeObject.getMessageId(), encodeObject.getGroupId(), encodeObject.getStreamId(),
                 Utils.getLocalIp(), encodeObject.getDt(), encodeObject.getPackageTime(), encodeObject.getRealCnt());
-        NettyClient client = clientMgr.getClientByRoundRobin();
+        NettyClient client = null;
+        switch (loadBalance) {
+            case "random":

Review Comment:
   plz make "random"、“consistency hash” ... as constants in constants class



-- 
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: commits-unsubscribe@inlong.apache.org

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