Skip to content

Commit

Permalink
feat: ensure large message batches can be received by subscribers (#1133
Browse files Browse the repository at this point in the history
)

This is the earliest client version that will support larger message sizes when they are allowed.
  • Loading branch information
dpcollins-google authored May 12, 2022
1 parent a2e5c92 commit 3276d47
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ public final class ServiceClients {
private static final int CLIENT_POOL_SIZE =
Integer.parseInt(System.getProperty("PUBSUB_LITE_CHANNELS_PER_CLIENT", "10"));

// Set maximum inbound message size to 20 MiB to match Cloud Pub/Sub and ensure at least 1 10 MiB
// message can be received in a subscribe batch.
private static final int MAX_INBOUND_MESSAGE_SIZE = 20 * 1024 * 1024;

private ServiceClients() {}

private static TransportChannelProvider getTransportChannelProvider() {
Expand All @@ -47,6 +51,7 @@ private static TransportChannelProvider getTransportChannelProvider() {
.setKeepAliveTimeout(Duration.ofMinutes(1))
.setPoolSize(CLIENT_POOL_SIZE)
.setExecutor(SystemExecutors.getFuturesExecutor())
.setMaxInboundMessageSize(MAX_INBOUND_MESSAGE_SIZE)
.build();
}

Expand Down

0 comments on commit 3276d47

Please sign in to comment.