Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

希望DUBBO能够支持隐式参数的回传,急需要这个功能 #895

Closed
hsrong opened this issue Nov 21, 2017 · 12 comments
Closed

希望DUBBO能够支持隐式参数的回传,急需要这个功能 #895

hsrong opened this issue Nov 21, 2017 · 12 comments

Comments

@hsrong
Copy link

hsrong commented Nov 21, 2017

No description provided.

@mercyblitz
Copy link
Contributor

@hsrong 能否更具体一点?

@hsrong
Copy link
Author

hsrong commented Nov 21, 2017

@mercyblitz
服务A调用服务B,现在希望服务B通过上下文而不是通过返回值的方式,给服务A返回某一个值,如:
public void methodA() {
methodB();//通过DUBBO调用服务B
value = 上下文.getXXX();
}
public void methodB(){
上下文.setXXX(value);
}
以上代码只是示例,实际编码过程中我们不会写侵入性这么强的代码,上下文值的设置和获取会被写在拦截器当中

@mercyblitz
Copy link
Contributor

我直觉地认为自定义 ThreadLocal是否可以满足?

@hsrong
Copy link
Author

hsrong commented Nov 22, 2017

@mercyblitz 不可以,因为服务A是通过DUBBO跨机器远程调用服务B

@chickenlj
Copy link
Contributor

@hsrong 你的需求是否同这个相同 #889,你们目前期待使用这种方式的典型业务场景是?

@hsrong
Copy link
Author

hsrong commented Nov 22, 2017

@chickenlj 是相同的,我是做架构的,我希望通过这种使用方式实现对业务方法做一些控制,对业务方法来说,这些控制是透明的。
实际上我已经实现了,如下:
image
image
image
实现得有问题希望指正,既然你们重启维护,希望还是由你们来实现

@devenfan
Copy link

@hsrong 其实你提交一个Pull Request可能来得更快…… 哦,你不会是在dubbox上修改的吧?

@willliang1991
Copy link

讲一下个人的理解,不一定准确,这种方式相当于直接传了个上下文到参数里面,然后可以直接通过参数来修改上下文(实际上因为是远程调用,经过了IO),但对于调用者的上下文来说不太可控,或者变更了什么无法在本地的代码里面看出来,查问题也比较麻烦。似乎跟微服务的理念不太一样(自治,高内聚,只通过RPC方式来交流)

@chickenlj
Copy link
Contributor

@hsrong You can create a Pull Request

@chickenlj
Copy link
Contributor

chickenlj commented Nov 29, 2017

Duplicate of #889

@chickenlj chickenlj marked this as a duplicate of #889 Nov 29, 2017
@Authorlove
Copy link
Contributor

consider adding new protocol version for the comparability

@iorilchen
Copy link

泛型调用时consumer端获取服务端传过来的attachment,获取不到

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants