Raise the default size of inbound message size in java bindings (#19325)

This commit is contained in:
mziolekda 2024-06-03 20:11:10 +02:00 committed by GitHub
parent 798f7d8bf4
commit 632d114191
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -45,6 +45,8 @@ public final class DamlLedgerClient implements LedgerClient {
private Optional<String> accessToken = Optional.empty();
private Optional<Duration> timeout = Optional.empty();
public static final int DefaultMaxInboundMessageSize = 10 * 1024 * 1024;
private Builder(@NonNull NettyChannelBuilder channelBuilder) {
this.builder = channelBuilder;
this.builder.usePlaintext();
@ -66,6 +68,11 @@ public final class DamlLedgerClient implements LedgerClient {
return this;
}
public Builder withMaxInboundMessageSize(int maxInboundMessageSize) {
this.builder.maxInboundMessageSize(maxInboundMessageSize);
return this;
}
public DamlLedgerClient build() {
return new DamlLedgerClient(this.builder, this.accessToken, this.timeout);
}
@ -83,7 +90,9 @@ public final class DamlLedgerClient implements LedgerClient {
* builder's capabilities
*/
public static Builder newBuilder(@NonNull String host, int port) {
return new Builder(NettyChannelBuilder.forAddress(host, port));
return new Builder(
NettyChannelBuilder.forAddress(host, port)
.maxInboundMessageSize(Builder.DefaultMaxInboundMessageSize));
}
/**