Giriş
Şu satırı dahil ederiz
import io.grpc.ManagedChannelBuilder;
Açıklaması şöyle
A gRPC channel is backed by one or more sub-channels; each sub-channel being a connection. Having more connections helps when you have multiple servers (backends) so each connection goes to a different backend. If you have a single server (backend) you should ensure that creating multiple connections to the same server will actually help which would be the case if the server is not the bottleneck and is able to process high network throughput.
forAddress metodu
Örnek
Şöyle yaparız
ManagedChannelBuilder.forAddress("127.0.0.1", 9091)
.executor(Executors.newCachedThreadPool())
.usePlaintext()
.build()
forTarget metodu
Şöyle yaparız
ManagedChannelBuilder.forTarget("grpc-server-service:80").defaultLoadBalancingPolicy("round_robin").usePlaintext().build();
Hiç yorum yok:
Yorum Gönder