I see, 2.7.0 copies the attachment in AbstractClusterInvoker, before the router 
extension. 





At 2019-01-21 10:50:44, "海洋" <[email protected]> wrote:
>Hi,
>
>
>I'v found that 2.7.0 will support tag route. Where does the tag route be set?
>
>
>Firstly, the TAG_KEY will be retrieved from the invocation. 
>private <T> List<Invoker<T>> filterUsingStaticTag(List<Invoker<T>> invokers, 
>URL url, Invocation invocation) {
>    List<Invoker<T>> result = invokers;
>// Dynamic param
>String tag = StringUtils.isEmpty(invocation.getAttachment(TAG_KEY)) ? 
>url.getParameter(TAG_KEY) :
>            invocation.getAttachment(TAG_KEY);
>The Invocation is created in InvokerInvocationHandler without attachment. I 
>know that the RpcContext has the Attachment, and it will be copied to 
>RpcInvocation in the filter chain, which behinds the Router. So, where to set 
>it?
>@Override
>public Object invoke(Object proxy, Method method, Object[] args) throws 
>Throwable {
>return invoker.invoke(createInvocation(method, args)).recreate();
>}
>
>private RpcInvocation createInvocation(Method method, Object[] args) {
>    RpcInvocation invocation = new RpcInvocation(method, args);
>    if (RpcUtils.hasFutureReturnType(method)) {
>        invocation.setAttachment(Constants.FUTURE_RETURNTYPE_KEY, "true");
>invocation.setAttachment(Constants.ASYNC_KEY, "true");
>}
>return invocation;
>}

Reply via email to