Skip to content

Generate Uni from Multi response of database after applying business logic #921

Answered by cescoffier
abnayak asked this question in Q&A
Discussion options

You must be logged in to vote

You need to collect the items into a Map.
See https://smallrye.io/smallrye-mutiny/guides/collecting-items#collecting-items-into-a-map.

In the end, you will have something like:

Multi<Object1> objects = DB.getAll(dbClient);
return Uni<Map<String, String>> uni =
        multi.collect()
                .asMap(item -> getUniqueKeyForItem(item)); // Put the computed key and the item to the Map

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@abnayak
Comment options

Answer selected by abnayak
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