I have a flow to get the keys. I use these keys to get their values, then the list of values (Promotion) must be returned.The problem is how to join these two flows. Thanks for the help.
I created the first flow then I transformed it to obtain a "UNI", but the result of the second flow returns another "UNI", which does not let me create the promotion list.
Code:
public Uni<List<Promotion>> listAll() { return this.reactiveRedisDataSource.key().keys("promo*") .onItem().ifNotNull() .transformToUni(keys -> { LOGGER.info("listAll ::: keys ::: " + keys); List<Promotion> promotions = new ArrayList<>(); promotions = keys.stream().map(key -> { return this.reactiveRedisDataSource .value(String.class, Promotion.class) .get(key).await().indefinitely(); }).toList(); return Uni.createFrom().item(promotions); }); }
ERROR:
The current thread cannot be blocked: vert.x-eventloop-thread-2