Last active
July 8, 2019 15:53
-
-
Save emmanuelbernard/6133ffc8adc0fc33df4ca0f9d3d97376 to your computer and use it in GitHub Desktop.
Foo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// uni | |
public interface Uni<T> { | |
static Uni<T> fromCompletionStage(CompletionStage<T> foo); | |
CompletionStage<T> subscribeToCompletionStage(); // start the execution eagerly (should it be named subscribeAndComplete) | |
U to(Class<U> clazz); // converts to whatever like Mono | |
U more(Class<U> clazz); // converts to whatever like Mono | |
... | |
// add operators | |
} | |
public class UniImpl extends CompletionStageImp implements Uni { | |
.. | |
} | |
class SomeMPAPI { | |
CompletionStage<Foo> bar(); | |
} | |
class SomeQuarkusAPI { | |
Uni<Foo> baz() { } ; | |
} | |
class SomeUserCode { | |
void someMethod() { | |
fromCompletionStage(someMPAPI.bar()).uniWizbang(); | |
someQuarkusAPI.baz().to(Single.class).rxWizbang(); | |
someQuarkusAPI.more(ExtraOperators.class).extraOperatorWizbang(); | |
// alternative of parallel classes from MP | |
someMPApi.unwrap(SomeQuarkusMPApi.class).bar().uniWizbang(); | |
} | |
} | |
//options | |
// [ ] Add a unwrap() on Uni to allow "more" operators | |
interface Multi extends Flow.Publisher { | |
// add operators | |
static Multi<T> fromPublisher(Flow.Publisher<T> foo); | |
U to(Class<U> clazz); // converts to whatever like Flux | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment