Skip to content

Why transformToUniAndConcatenate will return a Multi? #640

Answered by jponge
jiayaoO3O asked this question in Q&A
Discussion options

You must be logged in to vote

This is (mostly) for performing asynchronous operations on items, whereas transform performs synchronous operations.

A Uni is a good abstraction for an asynchronous operation like doing a database insert or posting to a message queue.
This is why the "mapper" returns a Uni, meaning "take this item and perform some operation that will eventually provide a result".

The resulting Multi collects the result for each Uni, the only difference is the order. Concatenation preserves the original Multi order, while merging pushes the results as soon as each Uni completes.

See https://smallrye.io/smallrye-mutiny/getting-started/transforming-items-async

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by jiayaoO3O
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants