Skip to content

docs(pubsub): add exactly-once samples#5442

Merged
dbolduc merged 1 commit intogoogleapis:mainfrom
dbolduc:docs-pubsub-exactly-once-samples
Apr 17, 2026
Merged

docs(pubsub): add exactly-once samples#5442
dbolduc merged 1 commit intogoogleapis:mainfrom
dbolduc:docs-pubsub-exactly-once-samples

Conversation

@dbolduc
Copy link
Copy Markdown
Member

@dbolduc dbolduc commented Apr 16, 2026

Fixes #5434 fixes #5438

@product-auto-label product-auto-label bot added api: pubsub Issues related to the Pub/Sub API. samples Issues that are directly related to samples. labels Apr 16, 2026
Comment thread src/pubsub/examples/src/lib.rs
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 16, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.74%. Comparing base (a2ccb22) to head (862609e).
⚠️ Report is 10 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5442      +/-   ##
==========================================
- Coverage   97.74%   97.74%   -0.01%     
==========================================
  Files         216      216              
  Lines       47549    47549              
==========================================
- Hits        46478    46477       -1     
- Misses       1071     1072       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dbolduc dbolduc marked this pull request as ready for review April 16, 2026 23:24
@dbolduc dbolduc requested a review from a team as a code owner April 16, 2026 23:24

let id = random_subscription_id();
subscription_names.push(format!("projects/{project_id}/subscriptions/{id}"));
subscription::create_subscription_exactly_once::sample(&client, &project_id, topic_id, &id)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do we need some cleanup here to delete the subscription ? The previous samples run the delete sample as the last one, which works as a clean up.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

oh I see, run_subscription_samples receives a subscription_names list to be filled with things to be deleted later.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yep, but you're right that this deserves a comment for context.

My next PR is going to add a comment around the delete subscription line that says it's just for testing a sample, and that all the other deletes are performed by the caller.

Comment thread src/pubsub/examples/src/subscriber/exactly_once.rs
@dbolduc dbolduc merged commit 78f52f3 into googleapis:main Apr 17, 2026
35 checks passed
@dbolduc dbolduc deleted the docs-pubsub-exactly-once-samples branch April 17, 2026 18:13
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 Pub/Sub API. samples Issues that are directly related to samples.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pubsub_create_subscription_with_exactly_once_delivery pubsub_subscriber_exactly_once

2 participants