Comments (7)
@zeljkot @jponge just added filter
: #157
from smallrye-mutiny.
@cescoffier I have read the discussion in issue #1
I'm a very beginner user of Reactive API to be honest and I haven't a very strong opinion.
That said, I think I prefer a less fluent API, so the 2nd choice.
from smallrye-mutiny.
I was chatting about this to @cescoffier and I mentioned I felt the former was more flexible, but the latter easier to read.
If there was a way to offer both, that would allow both use cases.
from smallrye-mutiny.
@FroMage, @vietj, and @ebernard had a chat yesterday.
Basically, there are a few alternatives:
- Flat structure like RX and Reactor:
-
too many methods, IDE completion not useful (we are talking about 400 methods with many overrides)-
not really usable by non-reactive / functional developer+
like RX
- Adding options, like:
uni.onTimeout(new TimeoutOptions().of(ofHours(1)).fail())
multi.onResult().flatMap(mapper, new FlatMapOptions().withConcurrency(2))
-
IDE does not guide you for the options-
duplicate all methods for the one with sensible defaults+
avoid most of the subgroups-
does not fix overloading like:flatMap
vs.flatMapUni
vs.flatMapIterable
- Flatten group as follows:
`onResultApply(Function<I, O>)` // map
`onResultMerge(Function<I, Multi<O>>)` // flatMap
`onResultConcat(Function<I, Multi<O>>)` // concatMap
`onResultMergeIterable(Function<I, Iterable<O>>)` // flatMap iterable
`onResultCompose(Function<I, Uni<O>>` // flatMapUni
-
Different wording-
Lots of method on Uni/Multi-
Missing fine-tuning (concurrency, scheduler...) as we would need to avoid overload
from smallrye-mutiny.
I've got one more thing to add to this topic, which I was finally able to put into words after quite some time of feeling "there's something wrong but I'm not sure what exactly":
This looks like a fluent API, but isn't.
It might sound obviously wrong, but the thing is: this is not a fluent API; it is two fluent APIs mixed into one. On one level, we have a fluent API for building the data pipeline. On the other level, we have a fluent API for configuring each stage of the pipeline.
(In addition, all the .onEvent().doSomething()
looks more like an event dispatcher instead of a pipeline. Yet it's still a pipeline. Not a fan.)
from smallrye-mutiny.
For common, well-established method I would provide first-level methods. This is already done for the map and flatMap. Writing onItem zillion times makes code less readable because almost every line starts with onItem() and then you must look for the real operation.
I would also shorten .transform().byFilteringItemsWith() to .filter().
For the less used things, I like the 2nd level. It keeps the first level clean.
from smallrye-mutiny.
Closing - out of date.
from smallrye-mutiny.
Related Issues (20)
- Downgrade JPMS support to an automatic module declaration HOT 1
- Proposal to Integrate Fault Tolerance Patterns into SmallRye Mutiny HOT 4
- Chain of onFailure().withBackOff() may break CompletableFuture invocation HOT 6
- Raise the baseline to Java 17
- expireIn/At backoff starts with 2^1 factor instead of 2^0 HOT 1
- Document the broadcast operator
- UniAwait may not pass null contexts
- Race-condition in the new concatMap operator
- Compilation fails with updated `maven-compiler-plugin` HOT 2
- Memory Leak when using Multi Replay HOT 6
- Race condition on UniCallbackSubscriber cancellation
- NullPointerException in MultiConcatMapOp HOT 4
- Cancellelation hangs when awaiting and still calls the uni when subscribing HOT 2
- Allow combining backoff retries with an until predicate
- How do I cancel a ticker HOT 4
- Multiple onTermination signals when retrying with backoffs
- Memory Leak when using toHotStream HOT 4
- Keep sub-page when navigating to latest version of a webpage HOT 1
- Propose a reduced jar with shaded dependencies
- Mutiny is creating zombie thread on delayIt() which are not doing anything after certain time HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from smallrye-mutiny.