簡體   English   中英

gRPC 消息超過最大大小 4194304:5145024

[英]gRPC message exceeds maximum size 4194304: 5145024

在 grpc 客戶端上調用服務器中的 rpc 方法后出現此錯誤。 我正在使用 grpc-spring-boot-starter (java)。 請告訴我如何增加響應大小。

        at io.grpc.stub.ClientCalls.toStatusRuntimeException(ClientCalls.java:262)
        at io.grpc.stub.ClientCalls.getUnchecked(ClientCalls.java:243)
        at io.grpc.stub.ClientCalls.blockingUnaryCall(ClientCalls.java:156)
  • 如果您使用的是官方 grpc 庫,請按以下方式創建客戶端。
ManagedChannel channel = ManagedChannelBuilder.forAddress("localhost", 9089).usePlaintext().maxInboundMessageSize(Integer.MAX_VALUE).build();

productsBlockingStub prodStub = productsGrpc.newBlockingStub(channel);

您可以在此處參考 grpc 項目。 只需添加修改 maxInboundMessageSize

  • 如果你正在使用 grpc-client-spring-boot-starter 那么你可以。
@GrpcClient("greeting-service")
    private GreetingServiceGrpc.GreetingServiceBlockingStub greetingServiceBlockingStub;

    greetingServiceBlockingStub = greetingServiceBlockingStub.withMaxInboundMessageSize(Integer.MAX_VALUE);
    greetingServiceBlockingStub = greetingServiceBlockingStub.withMaxOutboundMessageSize(Integer.MAX_VALUE);

或者在道具中添加這個。

grpc.client.greeting-service.max-inbound-message-size=9155241000
grpc.client.greeting-service.package-max-inbound-message-size=9155241000
grpc.client.greeting-service.server.max-inbound-message-size=9155241000

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM