How to convert Uni to Flow.Publisher #1320
-
It seems Uni does not implement Flow.Publisher, I have the following case. Multi.createFrom()
.items(
Post(title = "Quarkus 3.0", body = "test"),
Post(title = "Quarkus 3.0 and Koltin", body = "test")
)
.flatMap{ postRepository.persist(it) } // here 2nd para of function accepts a Flow.Publisher
.subscribe()
.with(
{ data -> LOGGER.log(Level.INFO, "saved data: $data") },
{ error -> LOGGER.log(Level.ALL, "error: $error") }
)
|
Beta Was this translation helpful? Give feedback.
Answered by
cescoffier
Jul 14, 2023
Replies: 1 comment 3 replies
-
Yes, Uni does not implement Publisher (see https://smallrye.io/smallrye-mutiny/2.0.0/reference/uni-and-multi/) You can convert a Uni to a Publisher using: Uni.convert().toPublisher(). |
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
hantsy
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yes, Uni does not implement Publisher (see https://smallrye.io/smallrye-mutiny/2.0.0/reference/uni-and-multi/)
You can convert a Uni to a Publisher using: Uni.convert().toPublisher().