#11 Add TracingSubscriber for RxJava2 Flowable usecases #12
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I've added TracingSubscriber (implementing FlowableSubscriber) which covers use cases where you need support for managing back-pressure.
As part of this I have renamed AbstractTracingObserver to RxTracer and made it a field of the implementations rather than inheriting it, which means we can use the same code for the TracingSubscriber as well as the TracingObserver - I've checked that this does not affect the public API as this was already package private.
I have had to make a change to the design for TracingSubscriber in how it is created, by adding static
createmethods for the various possibilities matching Flowable.subscribe(...). This is mostly because I don't really understand the purpose of TracingConsumer and I wouldn't know what to call a Subscriber equivalent to this (they also use Consumers underneath so it could get confusing!).An example of wrapping an existing subscriber currently looks like:
and an example of creating a TracingSubscriber directly:
Unless I am missing the reason for it's existence, I would consider deprecating/removing TracingConsumer and replacing it with static
createmethods on TracingObserver.If you have suggestions, please let me know!