Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // 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
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement