Quantcast
Channel: Active questions tagged redis+java - Stack Overflow
Viewing all articles
Browse latest Browse all 2204

How can I list all key values in reactive redis (quarkus)?

$
0
0

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

Viewing all articles
Browse latest Browse all 2204

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>