You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2021/08/24 04:54:56 UTC

[GitHub] [dubbo] zrlw commented on issue #8567: [2.7.13]多个引用同一个接口的DubboReference分别设置不同的事件回调时,只会生效一个

zrlw commented on issue #8567:
URL: https://github.com/apache/dubbo/issues/8567#issuecomment-904321568


   也可以变通一下解决这个问题:
   在DubboReference注解上加 parameters参数,同一个服务接口不同的Reference注解定义不同的参数,比如定义一个process参数,clientA用proc-a, clientB用proc-b:
   ```
   ClientA.java:
   @DubboReference( paramters = {"process", "proc-a"}, ...)
   DubboService s;
   ...
   ClientB.java:
   @DubboReference( paramters = {"process", "proc-b"}, ...)
   DubboService s;
   ```
   clientA和clientB的回调回调方法放到统一的门面组件里,回调方法依据rpccontext的url里取出process参数分别进行处理,比如:
   ```
   String process = RpcContext.getContext().getUrl.getParameter("process");
   switch (process) {
       case "proc-a": ....
       case "proc-b": ....
   }
   ```


-- 
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: notifications-unsubscribe@dubbo.apache.org

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



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org