Dear Jason, I am aware of that. However, as the MyRequestParams has multiple fields, we would like to avoid implementing the toString method that return a string containing only the URI field. This would break the purpose of the toString method.
Do you know any other approaches/work around for this? Best Dat On 2019/06/12 00:56:42, Jason Joo <[email protected]> wrote: > Hi, Tien > > Consistent hash is relying mainly the object's "toString()" protocol. So pls > make sure your objects have a unique and stable toString() method and it will > be ok. > > best regards, > > Jason > > > On Jun 11, 2019, at 16:58, [email protected] wrote: > > > > Dear experts, > > > > We are using Dubbo to export our services. For data load balancing, we > > would like to use the consistent hash load balancer. > > For the default usage of this load balancer, we can define either one or > > several parameters of the consumed method to be used as the hashing data. > > We wonder if it is possible to target the hashing on the field of an object > > passed as the param. > > For instance, the method interface is as follows: > > > > MyResponse getResponse(MyRequestParams params); > > > > The object params has a field named URI, which we would like to apply the > > hash algorithm upon. > > Of course, we can modify our method to: > > > > MyResponse getResponse(String uri, MyRequestParams params); > > > > But this really is contradictory with the design goal of MyRequestParam > > object (which is defined to wrap all our request params into one object) > > > > Best regards > > Tien Dat PHAN > >
