You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by GitBox <gi...@apache.org> on 2020/02/27 11:50:59 UTC

[GitHub] [servicecomb-java-chassis] xhanthow opened a new issue #1599: 上下文传递信息

xhanthow opened a new issue #1599: 上下文传递信息
URL: https://github.com/apache/servicecomb-java-chassis/issues/1599
 
 
   调用链路:前端请求->边缘服务->A微服务,A服务收到请求后往context里写了一些信息,用的是`ContextUtils`,然后边缘服务接收到response,获取刚才A微服务中设置的值,确获取不到。正确的姿势是什么了?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [servicecomb-java-chassis] xhanthow commented on issue #1599: 上下文传递信息

Posted by GitBox <gi...@apache.org>.
xhanthow commented on issue #1599: 上下文传递信息
URL: https://github.com/apache/servicecomb-java-chassis/issues/1599#issuecomment-591964144
 
 
   读取和设置的方法如下:
   ```
   InvocationContext context = ContextUtils.getInvocationContext();
   Map<String, String> mapContext = context.getContext();
   mapContext.get(key);
   ```
   ```
   InvocationContext context = ContextUtils.getInvocationContext();
   context.addContext(key, value);
   ```

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [servicecomb-java-chassis] xhanthow closed issue #1599: 上下文传递信息

Posted by GitBox <gi...@apache.org>.
xhanthow closed issue #1599: 上下文传递信息
URL: https://github.com/apache/servicecomb-java-chassis/issues/1599
 
 
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [servicecomb-java-chassis] yhs0092 commented on issue #1599: 上下文传递信息

Posted by GitBox <gi...@apache.org>.
yhs0092 commented on issue #1599: 上下文传递信息
URL: https://github.com/apache/servicecomb-java-chassis/issues/1599#issuecomment-592369785
 
 
   `InvocationContext` 就是正向传递的,不会从服务端返回客户端

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [servicecomb-java-chassis] xhanthow commented on issue #1599: 上下文传递信息

Posted by GitBox <gi...@apache.org>.
xhanthow commented on issue #1599: 上下文传递信息
URL: https://github.com/apache/servicecomb-java-chassis/issues/1599#issuecomment-592894996
 
 
   > `InvocationContext` 就是正向传递的,不会从服务端返回客户端
   
   好的,明白了

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [servicecomb-java-chassis] liubao68 commented on issue #1599: 上下文传递信息

Posted by GitBox <gi...@apache.org>.
liubao68 commented on issue #1599: 上下文传递信息
URL: https://github.com/apache/servicecomb-java-chassis/issues/1599#issuecomment-591957222
 
 
   边缘服务从 Invocation 里面应该是可以取到的。 从边缘服务读取的代码是怎么样的,在哪个环节? 

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [servicecomb-java-chassis] xhanthow commented on issue #1599: 上下文传递信息

Posted by GitBox <gi...@apache.org>.
xhanthow commented on issue #1599: 上下文传递信息
URL: https://github.com/apache/servicecomb-java-chassis/issues/1599#issuecomment-591967136
 
 
   正向的话是可以的,比如我在边缘服务上下文中写值,然后A微服务上下文中读取值,是正常的。但是反向的话就有问题了

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [servicecomb-java-chassis] xhanthow commented on issue #1599: 上下文传递信息

Posted by GitBox <gi...@apache.org>.
xhanthow commented on issue #1599: 上下文传递信息
URL: https://github.com/apache/servicecomb-java-chassis/issues/1599#issuecomment-591963173
 
 
   是在`onExecuteHttpServerFiltersFinish()`这个方法中读取的
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services