Skip to content
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

fix: set maxInboundMetadataSize in pubsub #3157

Merged
merged 6 commits into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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 @@ -436,6 +436,9 @@ public SubscriptionAdminClient subscriptionAdminClient(
@ConditionalOnMissingBean(name = "subscriberTransportChannelProvider")
public TransportChannelProvider subscriberTransportChannelProvider() {
return SubscriberStubSettings.defaultGrpcTransportProviderBuilder()
// default value specified by pubsub client library,
// see https://github.com/googleapis/java-pubsub/blob/main/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/Subscriber.java#L487.
.setMaxInboundMetadataSize(4 * 1024 * 1024)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to reference the default variable here instead of hardcoding the default value? Just so that we are aligned with the default in the client in case it changes in the future.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default value is a private variable that can't be referenced (source).

Copy link
Contributor

@mpeddada1 mpeddada1 Aug 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for checking, That is a little unfortunate that it can't be referenced at the moment. It might be worth creating a ticket in the client repo (similar to googleapis/java-pubsub#373)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.setKeepAliveTime(
Duration.ofMinutes(this.gcpPubSubProperties.getKeepAliveIntervalMinutes()))
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,17 @@ void maxInboundMessageSize_default() {
});
}

@Test
void maxInboundMetadataSize_default() {
contextRunner.run(
ctx -> {
TransportChannelProvider subscriberTcp =
ctx.getBean("subscriberTransportChannelProvider", TransportChannelProvider.class);
assertThat(FieldUtils.readField(subscriberTcp, "maxInboundMetadataSize", true))
.isEqualTo(4 * 1024 * 1024);
});
}

@Test
void retryableCodes_default() {
contextRunner.run(
Expand Down
Loading