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

samples: add publish with flow control sample #717

Merged
merged 2 commits into from
Jun 23, 2021
Merged

Conversation

anguillanneuf
Copy link
Contributor

For internal b/191088406

@snippet-bot
Copy link

snippet-bot bot commented Jun 15, 2021

Here is the summary of changes.

You are about to add 1 region tag.

This comment is generated by snippet-bot.
If you find problems with this result, please file an issue at:
https://github.com/googleapis/repo-automation-bots/issues.
To update this comment, add snippet-bot:force-run label or use the checkbox below:

  • Refresh this comment

@google-cla google-cla bot added the cla: yes This human has signed the Contributor License Agreement. label Jun 15, 2021
@product-auto-label product-auto-label bot added api: pubsub Issues related to the googleapis/java-pubsub API. samples Issues that are directly related to samples. labels Jun 15, 2021

try {
// Configure how many messages the publisher client can hold in memory
// before publishing succeeds, and what to do when messages exceed the limit.
Copy link
Contributor

Choose a reason for hiding this comment

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

What do you mean by "before publishing succeeds?"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed this clause.


publisher = Publisher.newBuilder(topicName).setBatchingSettings(batchingSettings).build();

// Publish 1000 messages in quick succession to trigger publisher flow control.
Copy link
Contributor

Choose a reason for hiding this comment

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

I wouldn't say "to trigger flow control." It's possible that flow control will be triggered, but it's also entirely possible it won't be if messages get out quickly enough. Either way, the fact that flow control was triggered isn't something that will be easily visible to the user. Maybe say "Rapidly publishing 1000 messages in a loop may be constrained by flow control."

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated. True, the user will only know for sure if they turn on logging.

@anguillanneuf anguillanneuf merged commit ade7981 into master Jun 23, 2021
@anguillanneuf anguillanneuf deleted the publish-flow branch June 23, 2021 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: pubsub Issues related to the googleapis/java-pubsub API. cla: yes This human has signed the Contributor License Agreement. samples Issues that are directly related to samples.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants