Replies: 2 comments
-
Hello, What about: multi.onItem().transformToUniAndConcatenate(x -> callService(x)) You can decide if you prefer concatenate or merge, depending on the behavior you want. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Hi Clement, Tanks a lot, it's exactly what I want. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am using a Multi for an event stream in a project. I call a remote service on the network, I loop on a Multi to call this network service, but at the first failure (sometimes the service is down so for each item, I will have the same error), and I want to cancel the stream at the first failure, I don't know how to do that?
Here a snippet of my code:
List myList = Stream.of("s1", "s2", "s3").collect(Collectors.toList());
Multi multi = Multi.createFrom().items(myList.stream());
multi.subscribe()
.with(s -> {
Uni uni = networkService(s);
uni
.subscribe()
.with(s2 -> {
logger.info("ok");
}, failure -> {
// At the first failure I want exit the stream and not continue.
logger.error("🔥 failure", failure.getMessage());
});
Thanks for any help
Regards
Beta Was this translation helpful? Give feedback.
All reactions