apache / pekko-persistence-r2dbc

Asynchronously writes journal and snapshot entries to configured R2DBC databases so that Apache Pekko Actors can recover state
https://pekko.apache.org/
Apache License 2.0
13 stars 6 forks source link

chore: Add MonoToFuture to reduce conversion. #96

Closed He-Pin closed 3 months ago

He-Pin commented 3 months ago

Motivation: toFuture.asScala seems quite boring, we can convert it to Scala Future directly.

Result: Less allocation/conversion

laglangyue commented 3 months ago

BTW, I have a question:

if a server provide a java-client using java completeFuture and a mono/flux client. Which should I use in pekko-streams api?

use completeFuture client, I can writer code Source.future(completeFuture.asScala) , or use the other like this PR

He-Pin commented 3 months ago

@laglangyue You can convert a Publisher to Pekko's Source, and a Pekko's Sink as a Publisher too, I mostly using CompletableFuture at $Work, but will use Pekko Stream when it fit best.

pjfanning commented 3 months ago

Generally looks ok but I'd prefer not to merge this till we split off a 1.0.x branch.

laglangyue commented 3 months ago

LGTM

He-Pin commented 3 months ago

Thanks.