I have recently discovered that HttpClientFs2Backend uses interop with reactive-streams in order to support streaming capabilities. This has several issues:
Since sttp requires JDK 11, using native java.util.concurrent.Flow seems to be more correct
For more context, I would also like to provide a task in which issue was discovered. I was implementing a handling of SSE stream of events in the background of my application, and I wanted to add an idle timeout (abort stream if there are no events for some period of time) using fs2 instrumentation timeoutOnPullTo:
- In case of using
HttpClientFs2Backend, cancellation never finished, connection stayed open and moreover application never closed
- In case of using
Http4sBackend, everything worked properly
In order to reproduce, I forked the HttpClientFs2Backend and changed implementation of lowLevelBodyToBody to use fs2.Stream.fromPublisher . This resolved an issue for me, now cancellation worked properly. Thus, I am creating this issue.
Finally, I believe the same behaviour can be obtained with ArmeriaFs2Backend because the same interop of fs2 with reactive-streams is used. However, I do not know what to do there, because Armeria uses reative-streams in the API
I have recently discovered that
HttpClientFs2Backenduses interop with reactive-streams in order to support streaming capabilities. This has several issues:java.util.concurrent.Flowand fs2, and avoid extra layer of interop with reactive streams.Since sttp requires JDK 11, using native
java.util.concurrent.Flowseems to be more correctFor more context, I would also like to provide a task in which issue was discovered. I was implementing a handling of SSE stream of events in the background of my application, and I wanted to add an idle timeout (abort stream if there are no events for some period of time) using fs2 instrumentation
timeoutOnPullTo:HttpClientFs2Backend, cancellation never finished, connection stayed open and moreover application never closedHttp4sBackend, everything worked properlyIn order to reproduce, I forked the
HttpClientFs2Backendand changed implementation oflowLevelBodyToBodyto usefs2.Stream.fromPublisher. This resolved an issue for me, now cancellation worked properly. Thus, I am creating this issue.Finally, I believe the same behaviour can be obtained with
ArmeriaFs2Backendbecause the same interop of fs2 with reactive-streams is used. However, I do not know what to do there, because Armeria uses reative-streams in the API