-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Adding a pubsub publisher message transformer #4599
Conversation
This will allow generic transformations of messages before a message is published.
Codecov Report
@@ Coverage Diff @@
## master #4599 +/- ##
============================================
- Coverage 49.17% 48.84% -0.33%
Complexity 21952 21952
============================================
Files 2078 2078
Lines 207459 207416 -43
Branches 24108 23416 -692
============================================
- Hits 102015 101322 -693
+ Misses 97270 97255 -15
- Partials 8174 8839 +665
Continue to review full report at Codecov.
|
To me, this looks like it would likely be abused by users to implement a pipeline construct, which doesn't seem to be the intent. This would mean the order of application would have to be guaranteed and never changed to prevent breaking user code. What would you think about instead of having this be intrinsic, making Publisher an Abstract Class/Interface, and having the user wrap their publisher, similar to guava's ForwardingQueue? Something like class CensusTrackedPublisher extends Publisher {
// Could be implicit, here for clarity.
CensusTrackedPublisher(Publisher delegate) {
super(delegate);
}
@Override
public ApiFuture<String> publish(PubsubMessage message) {
return delegate().publish(censusTransform(message));
}
} |
@dpcollins-google, it would seem to me that your suggestion would make the client backwards incompatible, which I don't think we can do. |
Codecov Report
@@ Coverage Diff @@
## master #4599 +/- ##
============================================
- Coverage 49.17% 48.84% -0.33%
Complexity 21952 21952
============================================
Files 2078 2078
Lines 207459 207416 -43
Branches 24108 23416 -692
============================================
- Hits 102015 101322 -693
+ Misses 97270 97255 -15
- Partials 8174 8839 +665
Continue to review full report at Codecov.
|
@sduskis in what way? Publisher only has a private constructor and can only be instantiated through the Builder. If Publisher were instead a public abstract class with one abstract method (Publish) and Builder.build() instead returned a {package-private} |
@dpcollins-google, there are public static methods on |
@sduskis This type of functionality seems like it should be above the Pub/Sub client since it's specific to the application.
You could also pass in a transform function in the constructor and use it ... but again still seems application specific. |
This will allow generic transformations of messages before a message is published.
This should help towards #4240