`doAfterSubscribe` operator?
See original GitHub issueSo I came from this StackOverFlow thread RxJava - .doAfterSubscribe()?. So that combination of mergeWith()/startWith()
and doOnComplete
works really fine but I think it’s a bit too creative to come up with by myself. I think lots of us want this approche because we are trying/experimenting for this architecture by Jake Wharton in the talk of Devoxx here: The State of Managing State with RxJava
.
So I wonder why don’t we have a build-in operator that can do this sort of work after your subscriber set up.
So it’s like a part of Observable can survive out side of the stream as a Subject.
Thanks!
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
doAfterSubscribe operator similar to doFirst #3286 - GitHub
simonbasle alternative idea: add it to SignalListener with a default NO-OP implementation.
Read more >rx java - RxJava - .doAfterSubscribe()? - Stack Overflow
Operator doOnSubscribe is executed on subscription. It can't be said that doOnSubscribe is run before subscription or after subscription.
Read more >What happens when we subscribe to a stream? A look inside ...
A look inside RxJava. Using RxJava seems rather simple: we create a stream, apply some operators, and then subscribe. But as our streams...
Read more >[Solved]-Is there a doAfterSubscribe equivalent in RxJava2?-Java
Coding example for the question Is there a doAfterSubscribe equivalent in ... Java regular expression - how to evaluate arithmetic operators while replacing ......
Read more >Monix 3.1.0 - monix.reactive.Observable
Applies a binary operator to a start value and all elements of this stream, going left to right and returns a new stream...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Operators have to be common enough, in-sequence and well defined to be considered including in RxJava proper. Sometimes, the context isn’t well defined or the operator is supposed to support a small set of developers’ thinking about solving a problem that can be solved through existing operators and composition (often requiring changing the viewpoint on the original problem as well).
RxJava is quite extendable through
compose
and you can write your own operator that intervenes in the lifecycle of a flow. For added convenience, you can consider using Kotlin where its extension methods even help you to make that custom operator appear to be an instance method on the reactive types of RxJava.Write an ObservableTransformer and call compose with it.