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: if a flow control setting is not provided use zero #292

Merged
merged 31 commits into from Jul 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
19dd129
Modifying Publish example in README to match other examples given, and
hannahrogers-google Nov 25, 2019
4158529
fix: Modifying Publish example in README to match other examples, and
hannahrogers-google Nov 25, 2019
7d704f0
Merge branch 'master' of github.com:hannahrogers-google/java-pubsub
hannahrogers-google Jan 9, 2020
9e0ebc6
Merge branch 'master' of https://github.com/googleapis/java-pubsub
hannahrogers-google Jan 9, 2020
01d41b7
feat: Adding support for DLQs
hannahrogers-google Jan 13, 2020
ed3b1ee
Fix formatting
hannahrogers-google Jan 13, 2020
72f7996
fix: making changes requested in pull request
hannahrogers-google Jan 14, 2020
389cb86
Merge branch 'master' of https://github.com/googleapis/java-pubsub
hannahrogers-google Jan 14, 2020
c9e4bd2
Merge branch 'master' of https://github.com/googleapis/java-pubsub
hannahrogers-google Jan 29, 2020
3738ec8
fix: creating fix to not populate delivery attempt attribute when dead
hannahrogers-google Jan 29, 2020
4ce1d3b
Merge branch 'master' of https://github.com/googleapis/java-pubsub
hannahrogers-google Jan 29, 2020
aecd4ca
Adding unit test for case in which a received message has no delivery…
hannahrogers-google Jan 30, 2020
77fa3b3
Making MessageWaiter class more generic to also be used for outstanding
hannahrogers-google Jan 30, 2020
b87023c
Merge branch 'master' of https://github.com/googleapis/java-pubsub
hannahrogers-google Jan 30, 2020
7086b3c
Merge branch 'master' into fix-subscriber-stop
hannahrogers-google Jan 30, 2020
da0e355
Waiting for acks to complete before shutting down a streaming subscriber
hannahrogers-google Jan 30, 2020
dc55fc1
Fixing formatting error
hannahrogers-google Jan 31, 2020
45beee2
Merge branch 'master' of https://github.com/googleapis/java-pubsub
hannahrogers-google Jan 31, 2020
548b7a7
fix: making sure all publishes complete before shutting down the
hannahrogers-google Jan 31, 2020
76a1de9
Merge branch 'master' of https://github.com/googleapis/java-pubsub
hannahrogers-google Feb 20, 2020
a8989f1
Merge branch 'master' of https://github.com/googleapis/java-pubsub
hannahrogers-google Feb 24, 2020
b4439fd
adding default max outstanding request bytes
hannahrogers-google Feb 24, 2020
01f607c
Merge branch 'master' of https://github.com/googleapis/java-pubsub
hannahrogers-google Feb 27, 2020
c0cddb3
Merge branch 'master' of https://github.com/googleapis/java-pubsub
hannahrogers-google Apr 29, 2020
9a6381d
fix: make push endpoint valid https
hannahrogers-google Apr 29, 2020
0bd165f
Merge branch 'master' of https://github.com/googleapis/java-pubsub
hannahrogers-google May 24, 2020
5d47be8
Merge branch 'master' of https://github.com/googleapis/java-pubsub
hannahrogers-google May 25, 2020
e3b7f6d
Merge branch 'master' of https://github.com/googleapis/java-pubsub in…
hannahrogers-google Jul 8, 2020
6c1a26c
Merge branch 'master' of https://github.com/googleapis/java-pubsub in…
hannahrogers-google Jul 23, 2020
f2fa6b8
fix: use default zero value if a flow control setting is not provided
hannahrogers-google Jul 23, 2020
0cd08dc
fix lint issues
hannahrogers-google Jul 23, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -216,8 +216,10 @@ private void initialize() {
.setSubscription(subscription)
.setStreamAckDeadlineSeconds(60)
.setClientId(clientId)
.setMaxOutstandingMessages(flowControlSettings.getMaxOutstandingElementCount())
.setMaxOutstandingBytes(flowControlSettings.getMaxOutstandingRequestBytes())
.setMaxOutstandingMessages(
kamalaboulhosn marked this conversation as resolved.
Show resolved Hide resolved
valueOrZero(flowControlSettings.getMaxOutstandingElementCount()))
.setMaxOutstandingBytes(
valueOrZero(flowControlSettings.getMaxOutstandingRequestBytes()))
.build());

/**
Expand Down Expand Up @@ -281,6 +283,10 @@ public void run() {
MoreExecutors.directExecutor());
}

private Long valueOrZero(Long value) {
return value != null ? value : 0;
}

private boolean isAlive() {
State state = state(); // Read the state only once.
return state == State.RUNNING || state == State.STARTING;
Expand Down
Expand Up @@ -19,6 +19,7 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

import com.google.api.gax.batching.FlowControlSettings;
import com.google.api.gax.core.ExecutorProvider;
import com.google.api.gax.core.FixedExecutorProvider;
import com.google.api.gax.core.InstantiatingExecutorProvider;
Expand Down Expand Up @@ -238,6 +239,8 @@ private Builder getTestSubscriberBuilder(MessageReceiver receiver) {
.setCredentialsProvider(NoCredentialsProvider.create())
.setClock(fakeExecutor.getClock())
.setParallelPullCount(1)
.setMaxDurationPerAckExtension(Duration.ofSeconds(5));
.setMaxDurationPerAckExtension(Duration.ofSeconds(5))
.setFlowControlSettings(
FlowControlSettings.newBuilder().setMaxOutstandingElementCount(1000L).build());
}
}