spring-cloud-aws icon indicating copy to clipboard operation
spring-cloud-aws copied to clipboard

Reactive S3 adapter - Project Reactor support

Open roger751 opened this issue 2 years ago • 18 comments

Type: Feature

Is your feature request related to a problem? Please describe. As specified in https://github.com/spring-cloud/spring-cloud-aws/issues/802 and in https://github.com/spring-projects/spring-integration-aws/issues/198, there should be support for Reactive Streams in the new AWS SDK v2 rewrite. I would be glad if this would be added to the milestone https://github.com/awspring/spring-cloud-aws/milestone/4.

Describe the solution you'd like Enable the usage of Project Reactor with spring cloud aws.

Describe alternatives you've considered As previously mentioned, this is a great example of self implementation https://github.com/eugenp/tutorials/tree/master/aws-reactive.

roger751 avatar Jan 03 '22 23:01 roger751

@maciejwalkowiak any updates on this?

markusherbert avatar Mar 25 '22 13:03 markusherbert

I think it would also be nice if there would be support for Spring Integration with Project Reactor. Something like ReactiveS3MessageHandler

markusherbert avatar Mar 25 '22 13:03 markusherbert

Not yet, but once https://github.com/awspring/spring-cloud-aws/pull/275 is done, this issue will become open for contributions.

maciejwalkowiak avatar Mar 25 '22 18:03 maciejwalkowiak

Anticipated feature. Also wanted with https://github.com/spring-projects/spring-integration-aws/issues/198 - a Reactive Spring Integration channel adapter.

jifeiiii avatar Mar 28 '22 12:03 jifeiiii

In regards to reactive - thinking how to do it right. We can easily auto-configure S3AsyncClient but likely we can do more. One is integrating code from Baeldung, another one is wrapping S3AsyncClient CompletableFutures with Mono in S3ReactiveClient. Wrapping could be done actually for all async clients.

If you have more ideas please share, perhaps we can come up here with conclusions and open this issue for contributions.

maciejwalkowiak avatar Apr 03 '22 19:04 maciejwalkowiak

Yeah wrapping S3AsyncClient with a reactive class that will still give access to the underlying client sounds like the ideal way to go

markusherbert avatar Apr 10 '22 21:04 markusherbert

I'd put S3AsyncClient as an argument in the constructor of S3ReactiveClient

markusherbert avatar Apr 10 '22 21:04 markusherbert

Any progress and a tracking issue so people can help?

jifeiiii avatar Apr 14 '22 13:04 jifeiiii

Design work is pending. We are open for suggestion or even PRs but can't guarantee that anything will get merged until we do more research.

maciejwalkowiak avatar Apr 16 '22 09:04 maciejwalkowiak

The latest versions of the SDK allows you to return an SdkPublisher<ByteBuffer> (which extends Publisher<ByteBuffer>) which you can use to map to the underlying byte array: https://sdk.amazonaws.com/java/api/latest/software/amazon/awssdk/core/internal/async/PublisherAsyncResponseTransformer.html.

The main issue with doing this is backpressure management is a bit of a pain here , from what I understand the upstream Publisher will basically buffer endlessly until finished, which for large files with slow consumers isn't necessarily ideal.

sgarfinkel avatar May 21 '22 17:05 sgarfinkel

@sgarfinkel I see that the Publisher you've mentioned is on an internal directory. I'm not sure if that's targeted for public use.

rolkhas2 avatar Jul 16 '22 16:07 rolkhas2

@maciejwalkowiak Can you publish the timeline for this issue? Users like me depend on this and cannot use Spring-Cloud-AWS at all without this issue being resolved.

lynch19 avatar Jul 23 '22 18:07 lynch19

@lynch19 it's almost certain this will not end up in 3.0. We have still too much work with other integrations to do before we can start working on reactive support. But, we're open for suggestions/contributions - if you have an idea how reactive support could look like, please let us know.

maciejwalkowiak avatar Jul 23 '22 22:07 maciejwalkowiak

@maciejwalkowiak I can try to take a basic start for this, but I'm not sure what have been already planned, or shall I just open some PR and let the discussion flow

lynch19 avatar Jul 26 '22 21:07 lynch19

Nothing has been planned so far so feel free to open a sketch PR but please keep in mind that it may not get merged.

maciejwalkowiak avatar Jul 27 '22 07:07 maciejwalkowiak

Would there be any progress on this subjectsoon?

zaredea avatar Sep 29 '22 08:09 zaredea

@zaredea No unless someone from the community comes up with a sketch PR.

maciejwalkowiak avatar Sep 29 '22 09:09 maciejwalkowiak

Considering the efforts needed to support reactive APIs we took the decision to not develop it in near future. We may embrace in the future async clients more than we do right now, which would make it easier for users to adapt to reactive apis themselves.

maciejwalkowiak avatar Apr 20 '23 04:04 maciejwalkowiak