Skip to content
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

Exposing publishAllOutstanding as a public API in PublisherInterface #949

Closed
elefeint opened this issue Dec 14, 2021 · 8 comments
Closed
Labels
api: pubsub Issues related to the googleapis/java-pubsub API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@elefeint
Copy link

In the last release of Spring Cloud GCP, we switched from returning Publisher to returning PublisherInterface in the convenience "Template" layer. This led to an accidental regression (GoogleCloudPlatform/spring-cloud-gcp#790).

Before we proceed with workarounds in Spring Cloud GCP, an API surface question for the client library -- does it make sense to add publishAllOutstanding() to PublisherInterface? Or is it not meant to be part of the public API?

@meredithslota
Copy link

@kamalaboulhosn @hannahrogers-google @hongalex @feywind for discussion.

@meredithslota
Copy link

Also @anguillanneuf for discussion.

@anguillanneuf
Copy link
Contributor

I have not used publishAllOutstanding() anywhere in samples. Deferring this to the other folks for comment.

@kamalaboulhosn
Copy link
Contributor

The PublisherInterface is used by the Pub/Sub Lite library. It does not implement the publishAllOutstanding() method, though. Therefore, adding the method to the interface would break the Pub/Sub Lite client library unless we added support for this method. I'm not sure how well that fits into Lite. Perhaps @dpcollins-google has some thoughts.

What was the reason for switching from Publisher to PublisherInterface?

@yoshi-automation yoshi-automation added the triage me I really want to be triaged. label Dec 15, 2021
@meltsufin
Copy link
Member

What was the reason for switching from Publisher to PublisherInterface?

It made it possible to add trace instrumentation here: GoogleCloudPlatform/spring-cloud-gcp#548. We basically needed a TracingPublisher that can be used in place of Publisher.

Note that it's impossible to subclass Publisher because it only has one private constructor.

@yoshi-automation yoshi-automation added the 🚨 This issue needs some love. label Dec 19, 2021
@meredithslota meredithslota added type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. and removed 🚨 This issue needs some love. triage me I really want to be triaged. labels Dec 22, 2021
@elefeint
Copy link
Author

Happy New Year! I am going to try switching Spring Cloud GCP to use Publisher.setTransform() instead of a custom implementation of PublisherInterface to add tracing information, since the need to interact with the full set of Publisher functionality came up once again in GoogleCloudPlatform/spring-cloud-gcp#864.

@kamalaboulhosn Could you confirm/clarify a couple of my assumptions --

  1. PublisherInterface is not meant to be the way to interact with Publisher functionality, and so is not expected to expose all public API methods of Publisher.
  2. Publisher.setTransform() is okay to use. It has @BetaApi on it, so I want to double check. The functionality was added for OpenCensus support, so it fits our usecase perfectly.

@hannahrogers-google
Copy link
Contributor

Hi @elefeint,

The only reason we added the PublisherInterface was because we created a Pub/Sub Lite service, as Kamal mentioned. The interface only exposes methods that are implemented by both the Pub/Sub Lite publisher client and the Cloud Pub/Sub publisher client to allow for seamless transition between Cloud Pub/Sub and Pub/Sub Lite. The other methods exposed by the Cloud Pub/Sub publisher client (like publishAllOutstanding) are not implemented by the Pub/Sub Lite client, which is why these methods are not included in the PublisherInterface.

Publisher.setTransform is okay to use, even though it has the BetaApi tag.

@elefeint
Copy link
Author

Thank you!

elefeint added a commit to GoogleCloudPlatform/spring-cloud-gcp that referenced this issue Jan 26, 2022
After the discussion in googleapis/java-pubsub#949, reverting back to using `Publisher` for all API return types. I've ported the trace header injection functionality from `TracingPublisher` into `TracingPublisherFactory`.

The Trace information will now get into a standard `Publisher` through a builder callback `PubsubMessage.Builder.setTransform()`.
elefeint added a commit to GoogleCloudPlatform/spring-cloud-gcp that referenced this issue May 25, 2022
After the discussion in googleapis/java-pubsub#949, reverting back to using `Publisher` for all API return types. I've ported the trace header injection functionality from `TracingPublisher` into `TracingPublisherFactory`.

The Trace information will now get into a standard `Publisher` through a builder callback `PubsubMessage.Builder.setTransform()`.
kateryna216 added a commit to kateryna216/spring-cloud-gcp that referenced this issue Oct 20, 2022
After the discussion in googleapis/java-pubsub#949, reverting back to using `Publisher` for all API return types. I've ported the trace header injection functionality from `TracingPublisher` into `TracingPublisherFactory`.

The Trace information will now get into a standard `Publisher` through a builder callback `PubsubMessage.Builder.setTransform()`.
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 googleapis/java-pubsub API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

No branches or pull requests

7 participants