-
Notifications
You must be signed in to change notification settings - Fork 553
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(pubsub): Add publisher flow control sample #12005
samples(pubsub): Add publisher flow control sample #12005
Conversation
Here is the summary of changes. You are about to add 1 region tag.
This comment is generated by snippet-bot.
|
The delete schema rpc is flaky and is a known issue. |
@@ -290,6 +290,37 @@ def publish_messages_async_with_concurrency_control topic_id: | |||
# [END pubsub_publisher_concurrency_control] | |||
end | |||
|
|||
def publish_messages_async_with_flow_control topic_id: | |||
# [START pubsub_publisher_flow_control] | |||
# topic_id = "your-topic-id" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would put this line a bit further down, just above the topic = ...
line where it is used, because that's where we'd expect to see it in actual code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the style throughout these samples, so it will be best not to change it in this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
grrr... well, I guess I'll open an issue.
|
||
topic = pubsub.topic topic_id, async: { | ||
# Configure how many messages the publisher client can hold in memory | ||
# before publishing succeeds, and what to do when messages exceed the limit. |
There was a problem hiding this comment.
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?"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed, thanks!
limit_exceeded_behavior: :block | ||
} | ||
} | ||
# Publish 1000 messages in quick succession to trigger publisher flow control. |
There was a problem hiding this comment.
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."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do, thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
CI error is delete_schema flake. |
closes: #11685
See also:
Java: googleapis/java-pubsub#717
Python: googleapis/python-pubsub#429