Skip to content

Remove fs2 interop with reactive-streams #2963

Description

@FireFoxIL

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions