英文:
Helidon Nima + gRPC example
问题
我正在启动一个新的 gRPC 项目,需要在明年初投入生产使用。我们一直在讨论在 Project Loom 稳定下来后是否迁移过去。由于大部分工作涉及基础架构,如果 Loom 和生态系统的状态不够稳定,重写代码不会带来很大风险。
不过,我注意到 Helidon Nima 支持 gRPC,而我们正好在服务器间通信中使用它。我找不到任何关于如何将它与一个可工作的示例连接起来的示例。有没有人能够提供一些指导?
英文:
I'm starting a new gRPC project that needs to be production ready early next year. We've been discussing about moving over to Project Loom when it stabilizes. As most of the work is around infra, rewriting code is not a huge risk in case Loom and the ecosystem is not in good enough shape.
Anyway, I noticed that Helidon Nima supports gRPC which we use for server-to-server communication. I could not find a single example anywhere for how to wire it up to a working example. Does anyone have any pointers?
答案1
得分: 2
以下是您要翻译的内容:
"这个问题也在 https://github.com/helidon-io/helidon/issues/7005 上发布,并且也会在这里发布回答:"
您可以在这里找到一个完整的示例:
https://github.com/helidon-io/helidon/tree/main/examples/nima/protocols
它在我们的 Web 服务器中使用了多个协议,包括 GRPC
简要总结:
- 我们在同一个服务器上使用 HTTP 和 grpc,确实需要 HTTP/2 服务器
- 您可以为 grpc 添加路由:
WebServer.builder()
.addRouting(GrpcRouting.builder()
.unary(Strings.getDescriptor(),
"StringService",
"Upper",
ProtocolsMain::grpcUpper))
.build()
.start()
请注意,我已经将代码部分保留为原文。
英文:
This question was also posted in https://github.com/helidon-io/helidon/issues/7005 and will also post the response here:
You can find a full example here:
https://github.com/helidon-io/helidon/tree/main/examples/nima/protocols
It uses multiple protocols with our webserver, including GRPC
Short summary:
- we use the same server to server HTTP and grpc, and it indeed requires HTTP/2 server
- you can add a routing for grpc:
WebServer.builder()
.addRouting(GrpcRouting.builder()
.unary(Strings.getDescriptor(),
"StringService",
"Upper",
ProtocolsMain::grpcUpper))
.build()
.start()
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论