-
Notifications
You must be signed in to change notification settings - Fork 391
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
SRPCHttpServer中不支持自定url映射方法 #404
Comments
上述的srpc/src/rpc_client.h 中可以自定义url,如果有,就使用自定义的,如果没有就采用默认的; struct srpc::RPCClientParams params = srpc::RPC_CLIENT_PARAMS_DEFAULT;
params.url = "http://127.0.0.1:1415/Test/Echo";
Example::SRPCHttpClient client(¶ms); srpc/src/rpc_server.h中加url映射,调用方式: server.add_service(&impl,"/Test/Echo=>Echo," "/Test/xxx=>Test"); |
感谢感谢!我们看一下。也可以发PR讨论。 |
@rayinengineer hi,感谢你提的这个需求,感觉非常合理呀~ 参考了下其他rpc系统的trans coding做法,没有统一的规范,所以我们当前使用了json来表达。比如: SRPCHttpServer server;
ExampleServiceImpl impl;
server.add_service(&impl, "{ \"/test/echo\": \"Echo\"," "\"/no/method/for/test\": \"Test\" }"); 麻烦有空了看看这个格式是否方便呢? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
像BRPC的服务框架,支持自定义url的映射,如
目前这边修改了一个
srpc/src/rpc_client.h 中增加两个模板特例
srpc/src/message/rpc_message_srpc.cc
srpc/src/rpc_server.h中增加该接口,该接口比add_service多了一个原来的路径映射到service 方法,如"Test/abc => Echo,Test/cde => Echo2"
增加特例实现,因为get_request_uri、set_request_uri只有在HTTP请求中才能获取到
The text was updated successfully, but these errors were encountered: