Exactly once delivery is best set with a locational endpoint. This adds the WithEndpoint option to the exactly once sample, and fixes the comments for ordering samples.
When you run your application within Google Cloud, it typically connects to the Pub/Sub endpoint in the same region by default. Therefore, running your application in a single region within Google Cloud generally ensures you are interacting with a single region.
If you are running your publisher application outside of Google Cloud or in multiple regions, you can guarantee you are connecting to a single region using a locational endpoint when configuring your Pub/Sub client. All location endpoints for Pub/Sub point to single regions. For a list of all locational endpoints for Pub/Sub, see List of locational endpoints.
Description
Exactly once delivery is best set with a locational endpoint. This adds the
WithEndpoint
option to the exactly once sample, and fixes the comments for ordering samples.When you run your application within Google Cloud, it typically connects to the Pub/Sub endpoint in the same region by default. Therefore, running your application in a single region within Google Cloud generally ensures you are interacting with a single region.
If you are running your publisher application outside of Google Cloud or in multiple regions, you can guarantee you are connecting to a single region using a locational endpoint when configuring your Pub/Sub client. All location endpoints for Pub/Sub point to single regions. For a list of all locational endpoints for Pub/Sub, see List of locational endpoints.