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 2020/05/15 07:11:12 UTC

[GitHub] [dubbo-go-hessian2] champly opened a new issue #189: how to rewrite attachment

champly opened a new issue #189:
URL: https://github.com/apache/dubbo-go-hessian2/issues/189


   ## 背景
   
   在 `service mesh`环境下,需要在 `sidecar` 中解析`dubbo`的`attachment`,并根据需求添加一些自定义的参数进去,就像`SetHeader`一样,然后重新构建 `dubbo` 包
   
   ## 问题
   
   如果使用`hessian.NewDecoder`,传递的参数没有对象是可以的,如果参数中有对象会报错,参考 #163 的解决办法,使用 `hessian.NewDecoderWithSkip`可以解决,但是重新构建的时候`arg`类型是`interface{}`,值是`nil`
   
   ## 解决
   
   能否多提供一个`Decode`方法,直接返回`[]byte`内容,重新构建的时候直接`encode.Encode(arg)`就可以重新构建`dubbo`包
   


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



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


[GitHub] [dubbo-go-hessian2] champly commented on issue #189: how to rewrite attachment

Posted by GitBox <gi...@apache.org>.
champly commented on issue #189:
URL: https://github.com/apache/dubbo-go-hessian2/issues/189#issuecomment-631860036


   ## solve
   
   ### decode
   
   1. use `hessian.NewDecoderWithSkip` Decode dubboVersion/path/version/method/argsTypes/args/attachment info.
   2. create hessian encode object, encode attachment.
   3. calc encode len
   
   ### encode
   
   1. encode.Append(payload[len(payload]-attachment_encode_len)
   2. encode.Encode(attachment)


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



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