Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save frank9615/040913af73b6f9abe542b4025f32716d to your computer and use it in GitHub Desktop.
Save frank9615/040913af73b6f9abe542b4025f32716d to your computer and use it in GitHub Desktop.
@QuarkusMain
@Slf4j
public class ExampleResource {
public static void main(String[] args) throws IOException {
Multi.createFrom().iterable(Arrays.asList(1,2,3,4))
.onItem()
.call(integer -> {
System.out.println(integer);
if(integer.equals(2)){
//Faccio fallire volontariamente il multi perchè
// è una condizione di uscita
return Uni.createFrom().failure(new Throwable("Condizione Complatata"));
}
return Uni.createFrom().voidItem();
})
.onFailure().recoverWithCompletion()
.collect().asList()
.onItem().invoke(integers -> System.out.println(integers))
.replaceWithVoid().await().indefinitely();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment