8

I’m using the Java Ledger Bindings to get packages from the ledger via the Package service and am getting the following error:

RESOURCE_EXHAUSTED: gRPC message exceeds maximum size

My application is based on the Ping-Pong example application and the daml model has about 300+ daml files.

The exception occurs around the following code block:

DamlLedgerClient client = DamlLedgerClient.forHostWithLedgerIdDiscovery(host, port, Optional.empty());
client.connect();
PackageClient packageService = client.getPackageClient();
Flowable<String> packagesIds = packageService.listPackages();
dsun
  • 208
  • 3
  • 6

1 Answers1

9

The message size is limited by the ManagedChannel used to connect to the gRPC server. To increase it, you have to construct and configure the ManagedChannel for gRPC yourself and pass it to the constructor of DamlLedgerClient.

ManagedChannel channel =
    ManagedChannelBuilder
    .forAddress(host,port)
    .usePlaintext()
    .maxInboundMessageSize(9999999)
    .build();
DamlLedgerClient client = new DamlLedgerClient(Optional.empty(), channel);
bame
  • 960
  • 5
  • 7