is subscribe().with() blocking? #1180
Answered
by
Ladicek
rafaeltuelho
asked this question in
Q&A
-
Hi! When I create a Mutiny and subscribe to it in the middle of a method like the one below, is this blocking equivalent to await() and also considered an antipattern? public void addPower(Power power) {
powers.add(power);
Mutiny.fetch(power.getHeroes())
.onItem()
.invoke((heroes) -> power.getHeroes().add(this))
.subscribe().with((heroes) -> logger.debugf("Hero (%s)<->Power(%s) association updated", this.getName(), power.getName()));
} thanks in advance. |
Beta Was this translation helpful? Give feedback.
Answered by
Ladicek
Jan 4, 2023
Replies: 1 comment 3 replies
-
It is not blocking (AFAIK), but it is kinda "fire and forget". The caller can't know when the process completes, which might be OK or not. You also don't handle possible errors, which again might be OK or not. |
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
jponge
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It is not blocking (AFAIK), but it is kinda "fire and forget". The caller can't know when the process completes, which might be OK or not. You also don't handle possible errors, which again might be OK or not.