1

I am trying to stream a big zip file with Multi through GRPC service as follows:

@GrpcService
class HelloGrpcService : HelloGrpc {
    override fun source(request: Empty?): Multi<SourceResponse> {
        val file = File("/Users/developer/Downloads/Archive.zip")
        val res = SourceResponse.newBuilder().setData(ByteString.readFrom(file.inputStream())).build()
        return Multi.createFrom().item(res)
    }
}

Unfortunately, I have received the following exception:

System.ArgumentException: The JSON value of length 212507417 is too large and not supported.

My goal is to stream the file and not to send it once. The question is how to stream a big file in GRPC?

Here is the proto file:

syntax = "proto3";

import "google/protobuf/empty.proto";

option java_multiple_files = true;
option java_package = "io.acme";
option java_outer_classname = "HelloGrpcProto";

package hello;


service HelloGrpc {
  rpc Source(google.protobuf.Empty) returns (stream SourceResponse) {}
}

message SourceResponse {
  bytes data = 1;
}
softshipper
  • 32,463
  • 51
  • 192
  • 400
  • Presumably you're going to read a small chunk of the file and send it in a loop. It might be easier if you used the Kotlin gRPC bindings. – Louis Wasserman Oct 09 '22 at 05:09
  • yes, exactly that is my goal to read small chunk of data. I am using https://quarkus.io/ that is why I must use java binding. – softshipper Oct 09 '22 at 06:04

0 Answers0