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 2022/12/20 02:00:46 UTC

[GitHub] [dubbo] wuwen5 commented on issue #10959: isConsumerSide 报 null 问题

wuwen5 commented on issue #10959:
URL: https://github.com/apache/dubbo/issues/10959#issuecomment-1358733497

   @AlbumenJ  这个问题任然存在
   
   case 1 泛化调用
   ```
   @Test
       public void testGenericService() {
           ReferenceConfig<GenericService> config = new ReferenceConfig<>();
           config.setInterface("org.apache.dubbo.samples.local.api.DemoService");
           config.setGeneric(Boolean.TRUE.toString());
           String result = (String)config.get().$invoke("sayHello", new String[]{"java.lang.String"}, new String[]{"world"});
       }
   ```
   
   case 2
   ```
   @Activate(group = {CommonConstants.PROVIDER, CommonConstants.CONSUMER})
   public class DubboRequestFilter implements Filter {
   
       private final static Logger log = LoggerFactory.getLogger(DubboRequestFilter.class);
   
       @Override
       public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException {
           RpcContext.getServiceContext().isConsumerSide();
           Result invoke = invoker.invoke(invocation);
           //NPE
           RpcContext.getServiceContext().isConsumerSide();
           return invoke;
       }
   }
   ```


-- 
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