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/09/10 09:52:23 UTC

[GitHub] [dubbo] fengcunhan commented on issue #8738: [3.0] Attachment is lost when calling without registry

fengcunhan commented on issue #8738:
URL: https://github.com/apache/dubbo/issues/8738#issuecomment-916780084


   你使用错了API,如果要获取服务器端带来的参数,应该使用RpcContext.getServerContext()
   
   `public void attachmentTest() {
           final String key = "user-attachment";
           final String value = "attachment-value";
           RpcContext.removeClientAttachment();
           RpcContext.getClientAttachment().setAttachment(key, value);
           delegate.greetWithAttachment(GreeterRequest.newBuilder().setName("meta").build());
           final String returned = (String) RpcContext.**getServerContext**().getObjectAttachment(key);
           Assert.assertEquals(value, returned);
       }`


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