-
Notifications
You must be signed in to change notification settings - Fork 652
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
fix(pubsub): Restart Google Pubsub subscriber on failures #263
Conversation
b94978c
to
cebc471
Compare
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.
LGTM, @jtk54 PTAL as well
return new GooglePubsubSubscriber(subscription.getName(), subscriptionName, project, subscriber); | ||
subscriber.addListener(new GooglePubsubFailureHandler(this, formatSubscriptionName(project, subscriptionName)), MoreExecutors.directExecutor()); | ||
subscriber.startAsync().awaitRunning(); | ||
log.info("Google Pubsub subscriber started"); |
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.
Can we add the subscription & project name to this log message?
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 looks great, and should make Echo much more robust to transient errors.
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.
Few comments, LGTM otherwise.
} | ||
|
||
private void restart() { | ||
log.info("Waiting to restart Google Pubsub subscriber"); |
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.
Can we add more context to this log statement as well?
@@ -81,7 +85,7 @@ public String subscriptionName() { | |||
|
|||
@Override | |||
public String getName() { | |||
return name; | |||
return subscriptionName; |
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.
We made a distinction between the subscriptionName
, which is the actual locator in GCE and the logical name
which is used in the UI when suggesting pub/sub subscriptions to use. Is there a reason to change that here?
cebc471
to
50ab8d0
Compare
@jtk54 That makes sense, I'll leave |
Great, thanks for the contribution. |
Creates a new
Subscriber
on failures, as according to googleapis/google-cloud-java#1579 (comment) we can"restart" the Subscriber by creating a new Subscriber object
.I've also removed
.setMaxAckExtensionPeriod(Duration.ofSeconds(0))
as googleapis/google-cloud-java#2465 (comment) recommends against it.Potentially solves spinnaker/spinnaker#2762 but needs more testing. I've verified that echo resumes consuming pubsub messages after I removed its
Pub/Sub Subscriber
permission (took a little while before it noticed) and then added it back again.