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

Feature Proposal: UnknownMethodHandler for KitexThrift/KitexProtobuf requests #1321

Open
felix021 opened this issue Apr 12, 2024 · 3 comments
Labels
help wanted Extra attention is needed

Comments

@felix021
Copy link
Contributor

felix021 commented Apr 12, 2024

A normal Kitex server is based on the IDL generated code, responsible for decoding requests into the go struct for the method handler. If a request with a method name not defined in its IDL is sent to this server, it will simply complain "unknown method" and refuse to process it.

Kitex also provides the "binary generic server" way, which takes in a request payload as a binary slice and sends it to the generic method handler, regardless of the method requested.

The problem is, these two types of server can not both exist within one server.

In this proposal, we sugguest an UnknownMethodHandler mechanism for a normal Kitex server to deal with requests with unknown methods.

If you are interested in implementing this feature, please reply with your lark id, and kindly prepare for a detailed tech plan.

Note: this might not be easy for a new Kitex contributor.

@felix021 felix021 added the help wanted Extra attention is needed label Apr 12, 2024
@felix021
Copy link
Contributor Author

@Zzhiter Do note that there's no way to force the client to use the same idl as the server. Say the svr has only one method Foo, you can always create another idl with method Bar for the client.

@Zzhiter
Copy link
Contributor

Zzhiter commented Apr 17, 2024

“Kitex also provides the "binary generic server" way, which takes in a request payload as a binary slice and sends it to the generic method handler, regardless of the method requested.

The problem is, these two types of server can not both exist within one server.”

Does ‘one server’ refers to a normal server handle normal request and binary generic request at the same time? As mentioned below:
https://www.cloudwego.io/zh/docs/kitex/tutorials/advanced-feature/generic-call/basic_usage/#%E4%BA%8C%E8%BF%9B%E5%88%B6%E6%B3%9B%E5%8C%96%E8%B0%83%E7%94%A8-1:~:text=%E4%BA%8C%E8%BF%9B%E5%88%B6%E6%B3%9B%E5%8C%96%E8%B0%83%E7%94%A8%E7%9A%84%E5%AE%A2%E6%88%B7%E7%AB%AF%E5%92%8C%E6%9C%8D%E5%8A%A1%E7%AB%AF%E5%B9%B6%E4%B8%8D%E6%98%AF%E9%85%8D%E5%A5%97%E4%BD%BF%E7%94%A8%E7%9A%84%EF%BC%8C%E5%AE%A2%E6%88%B7%E7%AB%AF%E5%8F%AA%E8%A6%81%E4%BC%A0%E5%85%A5%E6%AD%A3%E7%A1%AE%E7%9A%84%20Thrift%20%E4%BA%8C%E8%BF%9B%E5%88%B6%E7%BC%96%E7%A0%81%E6%A0%BC%E5%BC%8F%E7%9A%84%E5%8F%82%E6%95%B0%EF%BC%8C%E5%8F%AF%E4%BB%A5%E8%AF%B7%E6%B1%82%E6%99%AE%E9%80%9A%20Thrift%20%E6%8E%A5%E5%8F%A3%E6%9C%8D%E5%8A%A1%E3%80%82
I don't understand why binary generic server is mentioned here. Is it to make a normal Kitex server handle unknown methods like a generic server? I'm a little confused.

@felix021
Copy link
Contributor Author

@Zzhiter With this feature, a normal server shall be able to not only handle requests to its known methods, but also handle requests to unknown methods as the generic server way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Development

Successfully merging a pull request may close this issue.

2 participants