[英]LogNet gRPC Spring Boot starter - resolve service without service discovery
我正在嘗試設置將通過 gRPC 進行通信的 Spring Boot 微服務。 我正在使用 LogNet ( https://github.com/LogNet/grpc-spring-boot-starter ) Spring Boot starter 並試圖弄清楚如何讓客戶端/消費者服務“連接”到服務器/生產者服務不使用服務發現(例如 Eureka)。
我無法找到有關如何配置生產者以偵聽我指定的端口的信息。
然后我會嘗試使用如下代碼從消費者連接到它:
ManagedChannel channel = ManagedChannelBuilder.forAddress("127.0.0.1", 9110).usePlaintext()
.keepAliveWithoutCalls(true).build();
greeterStub = GreeterGrpc.newBlockingStub(channel);
顯然,與上面的代碼片段不同,主機和端口是可配置的。
如果生產者指的是 gRPC 服務器,那么您可以在application.yml/properties
配置其端口:
grpc:
port: 6565
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.