New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
API design #1
API design #1
Conversation
…e is received before getting a subscription.
…operators into initial-work # Conflicts: # smallrye-reactive-operators/src/main/java/io/smallrye/reactive/subscription/UniEmitter.java
You still have in |
Why is it inconsistent? You mean it should be |
Katia feedback:
|
Now I'm not happy with this, and I'm thinking about moving |
yeah |
What about instead of Then for |
If we don't need to support |
* @throws RuntimeException if the conversion fails. | ||
*/ | ||
public <O> O to(Class<O> clazz) { | ||
return new UniAdaptTo<>(upstream, nonNull(clazz, "clazz")).adapt(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the advantage to returning a new instance here instead of having some of the code that the class has around returning if it's the same thing, or returning a completion stage, and only handle actual adaptation in UniAdaptTo
?
Doesn't appear to be used anywhere else, so curious
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that can definitely be static.
This optimization can be done in a few places where we could pass the upstream
as a parameter, and so avoid the useless instantiation. To be honest I didn't focus on this so far.
…tion must be cancelled. Also the subscription must be dropped in terminal states.
…rs produce null or throw exceptions
Re |
So I'd like to highlight one concern I have with the proposed API. It's probably been decided already, but I'm gonna complain anyway :-) I really don't like how different parts of the API are split into different pieces, presumably to make it easier to navigate, understand, more fluent, etc. I very much disagree with this reasoning, because:
If you've made it here, thanks a lot! We don't have to agree, but I believe this just had to be expressed loudly :-) |
I think a parameter of
OK, got it. Perhaps this would warrant a shortcut, though. |
Rename receiveSubscriptionOn to subscribeOn Implement Multi.emitOn and Multi.subscribeOn
The idea was to be more explicit in the name. Initially [taking the
Yes, I agree. Created #20 to track this. |
Implement the Multi.onCompletion().ifEmpty group
Add Uni.onItem().mapToCompletionStage()
|
||
SmallRye Reactive Operators reuse and even rely on Reactive Streams. | ||
Some of the events are directly mapped from Reactive Streams _signals_. | ||
But, only `Multi` implements the Reactive Streams `Publisher`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One of the advantages of the Reactor classes is that they have a common superclass that can be used
elsewhere so that things that can be plugged onto either only have to be written once to the common interface.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will read the whole proposal carefully, the above is just an intial thought.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having a common interface can be tricky. Typically, it cannot be Publisher
, because, on Uni
we don't want to be a Publisher
(we can be wrapped into one). This allows supporting null
, for operation not providing an item.
So instead of having a common interface, I choose to provide a way to convert one to the other one (Uni -> Publisher, Multi -> Uni [potentially dropping elements])
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW, I'm not sure this files is up to date....
No description provided.