Skip to content

chore(gateway-service): configurable max channel inbound message size #141

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ class DefaultGraphQlServiceConfig implements GraphQlServiceConfig {
private static final String GATEWAY_SERVICE_HOST_PROPERTY = "gateway.service.host";
private static final String GATEWAY_SERVICE_PORT_PROPERTY = "gateway.service.port";
private static final String GATEWAY_SERVICE_CLIENT_TIMEOUT = "gateway.service.timeout";
private static final String GATEWAY_SERVICE_CLIENT_MAX_INBOUND_MESSAGE_SIZE =
"gateway.service.maxMessageSize.inbound";

private final String serviceName;
private final int servicePort;
Expand All @@ -44,6 +46,7 @@ class DefaultGraphQlServiceConfig implements GraphQlServiceConfig {
private final String gatewayServiceHost;
private final int gatewayServicePort;
private final Duration gatewayServiceTimeout;
private final int gatewayServiceMaxInboundMessageSize;

DefaultGraphQlServiceConfig(Config untypedConfig) {
this.serviceName = untypedConfig.getString(SERVICE_NAME_CONFIG);
Expand All @@ -64,6 +67,8 @@ class DefaultGraphQlServiceConfig implements GraphQlServiceConfig {
this.gatewayServicePort = untypedConfig.getInt(GATEWAY_SERVICE_PORT_PROPERTY);
this.gatewayServiceTimeout =
getTimeoutOrFallback(() -> untypedConfig.getDuration(GATEWAY_SERVICE_CLIENT_TIMEOUT));
this.gatewayServiceMaxInboundMessageSize =
untypedConfig.getBytes(GATEWAY_SERVICE_CLIENT_MAX_INBOUND_MESSAGE_SIZE).intValue();
}

@Override
Expand Down Expand Up @@ -136,6 +141,11 @@ public Duration getGatewayServiceTimeout() {
return gatewayServiceTimeout;
}

@Override
public int getGatewayServiceMaxInboundMessageSize() {
return this.gatewayServiceMaxInboundMessageSize;
}

private Duration getTimeoutOrFallback(Supplier<Duration> durationSupplier) {
return optionallyGet(durationSupplier)
.orElse(Duration.ofSeconds(DEFAULT_CLIENT_TIMEOUT_SECONDS));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,7 @@ attribute.service = {
gateway.service = {
host = localhost
port = 50071
maxMessageSize = {
inbound = 4MiB
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,6 @@ public interface GraphQlServiceConfig {
int getGatewayServicePort();

Duration getGatewayServiceTimeout();

int getGatewayServiceMaxInboundMessageSize();
}