question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`doAfterSubscribe` operator?

See original GitHub issue

So 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:closed
  • Created 6 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
akarnokdcommented, Jul 6, 2017

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.

0reactions
akarnokdcommented, Jul 6, 2017

Write an ObservableTransformer and call compose with it.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found