Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on May 8, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,11 @@ public static void subscribeWithErrorListenerExample(String projectId, String su
.setExecutorProvider(executorProvider)
.build();

// Listen for unrecoverable failures. Rebuild a subscriber and restart subscribing
// when the current subscriber encounters permanent errors.
// Listen for unrecoverable failures.
subscriber.addListener(
new Subscriber.Listener() {
public void failed(Subscriber.State from, Throwable failure) {
System.out.println(failure.getStackTrace());
if (!executorProvider.getExecutor().isShutdown()) {
subscribeWithErrorListenerExample(projectId, subscriptionId);
}
System.out.println("Unrecoverable subscriber failure:" + failure.getStackTrace());
}
},
MoreExecutors.directExecutor());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,14 @@ public static void subscribeWithExactlyOnceConsumerWithResponseExample(

Subscriber subscriber = null;
try {
subscriber = Subscriber.newBuilder(subscriptionName, receiverWithResponse).build();
// Pub/Sub's exactly once delivery guarantee only applies when subscribers connect to the
// service in the same region.
// For list of locational endpoints for Pub/Sub, see
// https://cloud.google.com/pubsub/docs/reference/service_apis_overview#list_of_locational_endpoints
subscriber =
Subscriber.newBuilder(subscriptionName, receiverWithResponse)
.setEndpoint("us-west1-pubsub.googleapis.com:443")
.build();
// Start the subscriber.
subscriber.startAsync().awaitRunning();
System.out.printf("Listening for messages on %s:\n", subscriptionName.toString());
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.