milvus-sdk-java icon indicating copy to clipboard operation
milvus-sdk-java copied to clipboard

Is there a plan to add MilvusClientV2 interface just like MilvusClient?

Open yeyinglang opened this issue 4 months ago • 4 comments

  1. If we have Interface, We can user dynamic proxy to add some extra features ,eg. failover/monitor/trace/health check ;
  2. other sdk support this features ,eg. lettuce、jedis、mybatis ;

Hope to add this features

yeyinglang avatar Aug 06 '25 08:08 yeyinglang

can you give us a more detailed example?

xiaofan-luan avatar Aug 07 '25 09:08 xiaofan-luan

Take Lettuce SDK as a example:

we use proxy+redis pattern; maybe a redis cluster has 100 proxy instances ; Client create more than 100 connection, so we need balance request to those connections ,meanwhile we are consistent with RedisAsyncCommands's API so

  1. user has Delegated Obj, maybe called: redisDelegated;
  2. user execute some query , eg: redisDelegated.set(), redisDelegated.get()
  3. we need use dynamic proxy to keep user's request balance to all connections

Pseudo code

RedisAsyncCommands commands = Proxy.newProxyInstance(RedisAsyncCommands.getClassLoader(), new Class[]{RedisAsyncCommands.class, new InvocationHandler(){
// 1. get random connection
// 2. monitor/ktrace 
// 3. health check 
}})

commands.set(key,value)
commands.get(key)

Did I make myself clear?

yeyinglang avatar Aug 07 '25 13:08 yeyinglang

Thanks for the classification. So it's essentially a command control system that allows you to execute commands via reflection.

xiaofan-luan avatar Aug 07 '25 15:08 xiaofan-luan

yeah, If the MilvusClientV2 has interfaces that can allow users do some extra features via reflection ; It'll be more user-friendly

yeyinglang avatar Aug 08 '25 03:08 yeyinglang