Skip to content

Repeat of the pagination process #1222

Discussion options

You must be logged in to vote

I can cleanup state 'manually'

    public static Uni<Void> pagination1() {
        return Multi.createBy()
                .repeating()
                .uni(AtomicInteger::new, state -> {
                    System.out.println(state.get());
                    state.incrementAndGet();
                    return Uni.createFrom().item(state);
                })
                .whilst(e -> {
                    boolean retry = e.get() < 3;
                    if (!retry) {
                        // cleanup the state
                        e.set(0);
                    }
                    return retry;
                })
                .onItem()
                .ignoreAsUni();
    }

An…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by gkozyryatskyy
Comment options

You must be logged in to vote
0 replies
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