From b179396cf482c2920c226982d7f4b84cd8e6452a Mon Sep 17 00:00:00 2001 From: Yvette Zhang Date: Mon, 28 Aug 2023 22:29:43 -0400 Subject: [PATCH] set message length --- src/main/java/com/clarifai/channel/ClarifaiChannel.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/com/clarifai/channel/ClarifaiChannel.java b/src/main/java/com/clarifai/channel/ClarifaiChannel.java index f9d170e..a468021 100644 --- a/src/main/java/com/clarifai/channel/ClarifaiChannel.java +++ b/src/main/java/com/clarifai/channel/ClarifaiChannel.java @@ -14,6 +14,8 @@ public enum ClarifaiChannel { INSTANCE; + public static final int MAX_MESSAGE_LENGTH = 128 * 1024 * 1024; // 128MB + private enum MarshallerType { PROTO, JSON, @@ -33,6 +35,7 @@ public ManagedChannel getGrpcChannel(String base) { marshallerType = MarshallerType.PROTO; return NettyChannelBuilder .forAddress(base, 443) + .maxInboundMessageSize(MAX_MESSAGE_LENGTH) .sslContext( GrpcSslContexts.forClient() .trustManager(InsecureTrustManagerFactory.INSTANCE) @@ -50,6 +53,7 @@ public ManagedChannel getInsecureGrpcChannel() { return NettyChannelBuilder .forAddress("api-grpc.clarifai.com", 18080) .usePlaintext() + .maxInboundMessageSize(MAX_MESSAGE_LENGTH) .build(); }