Skip to content
This repository has been archived by the owner on Jan 19, 2022. It is now read-only.

Differentiate between Publisher and Subscriber TransportChannelProvider #2520

Merged
merged 4 commits into from
Sep 11, 2020

Conversation

meltsufin
Copy link
Contributor

Ensures that the correct client library defaults are applied for maxInboundMessageSize.

Fixes: #2511.

Ensures that the correct client library defaults are applied for `maxInboundMessageSize`.

Fixes: #2511.
Copy link
Contributor

@elefeint elefeint left a comment

Choose a reason for hiding this comment

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

Also need to document the potentially breaking change -- if someone defined a transport channel without annotations, it will no longer be used.


TransportChannelProvider subscriberTcp = ctx.getBean("subscriberTransportChannelProvider", TransportChannelProvider.class);
assertThat(FieldUtils.readField(subscriberTcp, "maxInboundMessageSize", true))
.isEqualTo(20 << 20);
Copy link
Contributor

Choose a reason for hiding this comment

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

define a 20MB constant maybe? Bit shifting is a bit obfuscated.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's a copy-paste from the client library.

@meltsufin
Copy link
Contributor Author

Also need to document the potentially breaking change -- if someone defined a transport channel without annotations, it will no longer be used.

We never documented that customization. So, I think it's fair to break it. I will add it to release notes though.

Copy link
Contributor

@elefeint elefeint left a comment

Choose a reason for hiding this comment

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

LGTM, but perhaps a follow-up issue to differentiate Topic/Subscriber admin functionality channel.

@@ -352,12 +353,12 @@ public TopicAdminClient topicAdminClient(
@Bean
@ConditionalOnMissingBean
public TopicAdminSettings topicAdminSettings(
TransportChannelProvider transportChannelProvider) {
@Qualifier("publisherTransportChannelProvider") TransportChannelProvider publisherTransportChannelProvider) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if admin functionality should have its own. The most obvious usecase is needing different credentials for admin operations.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@sonarcloud
Copy link

sonarcloud bot commented Sep 11, 2020

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 0 Security Hotspots to review)
Code Smell A 0 Code Smells

100.0% 100.0% Coverage
0.0% 0.0% Duplication

warning The version of Java (1.8.0_151) you have used to run this analysis is deprecated and we will stop accepting it from October 2020. Please update to at least Java 11.
Read more here

@codecov
Copy link

codecov bot commented Sep 11, 2020

Codecov Report

Merging #2520 into master will decrease coverage by 7.21%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #2520      +/-   ##
============================================
- Coverage     81.43%   74.22%   -7.22%     
+ Complexity     2383     2157     -226     
============================================
  Files           267      267              
  Lines          7737     7740       +3     
  Branches        799      799              
============================================
- Hits           6301     5745     -556     
- Misses         1098     1626     +528     
- Partials        338      369      +31     
Flag Coverage Δ Complexity Δ
#integration 81.44% <100.00%> (+<0.01%) 2384.00 <2.00> (+1.00)
#unittests 74.22% <100.00%> (+0.01%) 2157.00 <2.00> (+1.00)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ Complexity Δ
...ure/pubsub/GcpPubSubEmulatorAutoConfiguration.java 100.00% <ø> (ø) 2.00 <0.00> (ø)
...toconfigure/pubsub/GcpPubSubAutoConfiguration.java 91.11% <100.00%> (+0.20%) 39.00 <2.00> (+1.00)
...gcp/secretmanager/SecretManagerPropertySource.java 0.00% <0.00%> (-100.00%) 0.00% <0.00%> (-4.00%)
...a/spanner/repository/query/SpannerQueryMethod.java 0.00% <0.00%> (-100.00%) 0.00% <0.00%> (-6.00%)
...retmanager/SecretManagerPropertySourceLocator.java 0.00% <0.00%> (-100.00%) 0.00% <0.00%> (-2.00%)
...figure/config/GcpConfigBootstrapConfiguration.java 0.00% <0.00%> (-100.00%) 0.00% <0.00%> (-2.00%)
...e/spanner/GcpSpannerEmulatorAutoConfiguration.java 0.00% <0.00%> (-100.00%) 0.00% <0.00%> (-2.00%)
...epository/config/SpannerRepositoriesRegistrar.java 0.00% <0.00%> (-100.00%) 0.00% <0.00%> (-3.00%)
...ository/config/DatastoreRepositoriesRegistrar.java 0.00% <0.00%> (-100.00%) 0.00% <0.00%> (-3.00%)
...restore/GcpFirestoreEmulatorAutoConfiguration.java 0.00% <0.00%> (-84.85%) 0.00% <0.00%> (-4.00%)
... and 55 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5217e42...861f199. Read the comment docs.

@meltsufin meltsufin merged commit 9d23437 into master Sep 11, 2020
@meltsufin meltsufin deleted the pubsub-transport-channel-provider branch September 11, 2020 18:49
meltsufin added a commit that referenced this pull request Oct 8, 2020
…er (#2520)

Ensures that the correct client library defaults are applied for `maxInboundMessageSize`.

Fixes: #2511.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Pub/Sub: TransportChannelProvider MaxInboundMessageSize default value not sufficient
2 participants