-
Notifications
You must be signed in to change notification settings - Fork 236
Refactor pubsub protocol to use new upstream v2 library #1180
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
Conversation
b93aca6 to
d97e465
Compare
|
Just here to say we have same issue. We are unable to upgrade to libraries using pubsub/v2 because the cloudevents SDK is not yet supporting it. |
Can you please update the public config parameters/related options to indicate this and reduce developer experience issues?
Seems those are mainly used internally and not really breaking the public API (despite the upgrade to v2 obviously being considered a breaking change)? |
9dd1209 to
20ff54a
Compare
imho there is no change in cloudevents public config by that change. It still requires a ProjectID and topic/subscription ID as formerly, which are then passed down to PubSub SDK. But now they get concat before being passed down and formerly PubSub SDK did that internally I assume.
Correct: The new |
20ff54a to
ba7fb2f
Compare
But IMHO that contradicts your comment |
I was referring to the changes required for the migration to PubSub v2 library: it now requires them to be fully-qualified but as the cloudevents user supplies both projectID and topicID/subID anyways, we can simply construct the FQDN by the same supplied options as before. |
embano1
left a comment
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.
Just a nit, otherwise LGTM if CI passes and assuming you've verified this change in a real PubSub environment?
| if st, ok := status.FromError(err); ok && st.Code() == codes.NotFound { | ||
| return false, nil // Topic does not exist. | ||
| } | ||
| return false, fmt.Errorf("unable to get topic %q, %v", topicID, err) |
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.
nit: use %w for error wrapping?
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.
good idea but since the calling function bubbles-up any caught errors and wraps them again with %v, it would need changes there too. So I'll leave it as is as its likely not used with errors.Is anywhere or would have caused issues before
|
@embano1 thanks for the review and approval 👍 you might need to kick-off the remaining CI workflows? |
|
Thx, I'll merge once #1183 is merged as we're upgrading tooling and requiring updated workflows to pass. |
ba7fb2f to
c09a7f2
Compare
See googleapis/google-cloud-go#12218 for reference Signed-off-by: Philipp Schuler <philipp.schuler@command-b.de>
Signed-off-by: Philipp Schuler <philipp.schuler@command-b.de>
Signed-off-by: Philipp Schuler <philipp.schuler@command-b.de>
c09a7f2 to
35623f2
Compare
I rebased my branch onto latest master after you merged. I also added a little chore commit for replacing deprecated grpc calls in two of the tests. Hope you dont mind |
|
Thx, running CI with auto-merge. |
|
@embano1 whats the general release schedule for the cloudevents SDK? (This here kinda blocks our upgrade path) |
|
We can cut a release any time cc/ @duglin |
|
I have no objection to creating a new release |
|
@embano1 I would like to kindly ask for a new release as there doesnt seem to be any objection :) Thanks in advance for your efforts! |
|
On it. Sorry for my silence, been traveling. |
|
Done, just don't have the time to create release notes ATM: https://github.com/cloudevents/sdk-go/releases/tag/v2.16.2 |
The GCP GO SDK introduced a new v2 version of their PubSub library with the v1.50 release of the pubsub pkg. Deprecating the old interface and encouraging to upgrade within a 1yr grace period. See googleapis/google-cloud-go#12218 for reference
For downstream users (like me) being able to update to the new v2 library while also using the cloudevents SDK, its necessary to upgrade the pubsub protocol in the cloudevents SDK or we cannot pass in types to funcs like
WithReceiveSettingsanymore.Sooo I took the chance and migrated the code to use pubsub/v2.
Noteworthy changes:
Existsfunctions on Topic/Subscription and suggest optimistically using them and handling NotFound errors.(https://github.com/googleapis/google-cloud-go/blob/main/pubsub/MIGRATING.md)
PS: as a separate commit, I added a fix for the existing ReceiveSettings assertion that didnt actually test for the passed in ReceiveSettings anymore as the NumGoRoutines override was removed after these assertions were initially added