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

MOSN不支持反向push的协议,如果自己实现的话代码改动的方向是什么样的呢? #2389

Open
dhsjgdf opened this issue May 7, 2024 · 4 comments

Comments

@dhsjgdf
Copy link

dhsjgdf commented May 7, 2024

使用MOSN解析rocketmq协议时发现rocketmq有反向push的请求(就是rocketmq-broker主动发起请求到rocketmq-consumer),但是MOSN不支持此类协议,如果我实现这样能力的话,需要如何改造MOSN呢?

@taoyuanyuan
Copy link
Contributor

taoyuanyuan commented May 8, 2024

需要一个新的network filter扩展,类似 proxy(https://github.com/mosn/mosn/tree/master/pkg/filter/network/proxy), 这个filter的模型是ping-pong。

@dhsjgdf
Copy link
Author

dhsjgdf commented May 8, 2024

https://github.com/mosn/mosn/tree/master/pkg/filter/network/proxy研究过这个包里面的代码,看完之后感觉没什么帮助;现在rocketmq协议中既有正向的请求(rocketmq-comsuer-->rocketmq-broker)又有反向请求(rocketmq-broker-->rocketmq-comsuer),我想着从handleFrame方法入手来改,但是mosn多路复用的实现不是想象的是一个map,往里面存就好了,从handleFrame也没法入手,现在不知道该怎么办了
image

@alpha-baby
Copy link
Member

你要做的就是把 upstream 和 downstream 的 tcp 连接给关联起来,当 upstream 的连接来数据过后,直接发给关联的 downstream 连接
如果你想找代码参考,可以看 https://github.com/envoyproxy/envoy/tree/main/contrib/rocketmq_proxy/filters/network/source

@dhsjgdf
Copy link
Author

dhsjgdf commented May 8, 2024

我知道我应该 upstream 和 downstream 的 tcp 连接给关联起来,但是不知道如何下手;envoy是C++写的,之前看过rocktemq那块的功能也看不懂就放弃了

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

3 participants