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

Jersey MP Rest client SseEventPublisher should use blocking strategy #5425

Closed
danielkec opened this issue Sep 27, 2023 · 0 comments · Fixed by #5426
Closed

Jersey MP Rest client SseEventPublisher should use blocking strategy #5425

danielkec opened this issue Sep 27, 2023 · 0 comments · Fixed by #5426

Comments

@danielkec
Copy link
Contributor

Jersey MP Rest client SseEventPublisher uses SubmissionPublisher internally with PublisherStrategy.BEST_EFFORT and it's SubmissionPublisher#offer method for non-blocking submission.
This makes it non compliant with Reactive Streams for JVM TCK.

Problem this that ignoring backpressure and relying on "Slow subscriber" error is outside the Reactive Streams for JVM spec and because of that also makes it non compliant with MicroProfile REST Client TCK.

All that should be done is to actually propagate back-pressure by oldschool blocking:

diff --git a/ext/microprofile/mp-rest-client/src/main/java/org/glassfish/jersey/microprofile/restclient/SseEventPublisher.java b/ext/microprofile/mp-rest-client/src/main/java/org/glassfish/jersey/microprofile/restclient/SseEventPublisher.java
--- a/ext/microprofile/mp-rest-client/src/main/java/org/glassfish/jersey/microprofile/restclient/SseEventPublisher.java	(revision 8a63706db096dcadd0e13195515c56b9cb394279)
+++ b/ext/microprofile/mp-rest-client/src/main/java/org/glassfish/jersey/microprofile/restclient/SseEventPublisher.java	(date 1695803963089)
@@ -66,7 +66,7 @@
 
         this.executor = executor;
         this.genericType = genericType;
-        this.publisher = new JerseyPublisher<>(executor::submit, JerseyPublisher.PublisherStrategy.BEST_EFFORT);
+        this.publisher = new JerseyPublisher<>(executor::submit, JerseyPublisher.PublisherStrategy.BLOCKING);
     }
 
     private static final Logger LOG = Logger.getLogger(SseEventPublisher.class.getName());

This is a probable root-cause of helidon-io/helidon/issues/5083

@danielkec danielkec changed the title JerseySseBroadcaster should have configurable offer strategy Jersey MP Rest client SseEventPublisher should use blocking strategy Sep 27, 2023
jansupol pushed a commit that referenced this issue Oct 10, 2023
)

* Propagate backpressure correctly in MP REST Client SSE publisher #5425
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant