Questions tagged [rx-java]

RxJava – Reactive Extensions for the JVM – a library for composing asynchronous and event-based programs using observable sequences for the Java VM.

RxJava is a Java implementation of Reactive Extensions. Android-specific support for RxJava is provided by .

The main goals of RxJava

  • Stay true to the principles and concepts behind the original implementation while adjusting to the naming conventions and idioms of Java
  • All contracts of Rx should be the same target - the JVM
  • JVM-based languages supported (beyond Java itself) include , , , and
  • Support Java 6+

The library is open sourced under Apache 2.0 license.

References

6958 questions
59
votes
11 answers

How to ignore error and continue infinite stream?

I would like to know how to ignore exceptions and continue infinite stream (in my case stream of locations)? I'm fetching current user position (using Android-ReactiveLocation) and then sending them to my API (using Retrofit). In my case, when…
Ziem
  • 6,579
  • 8
  • 53
  • 86
58
votes
4 answers

What is the difference between EventBus and RxJava?

I am confused about the difference between EventBus and RxJava in android. I need to implement one of them for my issue about notifying some components when some changes have been done, so that they can update their state. Also, I read that…
HiddenDroid
  • 1,440
  • 4
  • 14
  • 27
56
votes
4 answers

What is CompositeDisposable in RxJava

I am an Android Student. I want to learn RxJava. My Question is "What is CompositeDisposable in RxJava?". Please describe in detail.
Tester
  • 573
  • 1
  • 4
  • 7
56
votes
1 answer

RxJava: difference between doOnNext and doOnEach

In which cases I should use doOnNext, and in which cases doOnEach? .doOnEach(new Action1>() { @Override public void call(Notification notification) { …
VasyaFromRussia
  • 1,872
  • 2
  • 14
  • 18
56
votes
2 answers

RxJava Fetching Observables In Parallel

I need some help in implementing parallel asynchronous calls in RxJava. I have picked up a simple use case wherein the FIRST call fetches (rather searches) a list of products (Tile) to be displayed. The subsequent calls go out and fetch (A) REVIEWS…
diduknow
  • 1,624
  • 2
  • 13
  • 10
52
votes
4 answers

BehaviorSubject vs PublishSubject

I'm trying to get my head around the golden rule (if any) about: When to use BehaviorSubject ? and When to use PublishSubject ? The difference between them is very clear There are many kinds of subjects. For this specific requirement, a…
TooCool
  • 10,598
  • 15
  • 60
  • 85
52
votes
1 answer

Subscribewith Vs subscribe in RxJava2(Android)?

When to call the subscribeWith method rather than plain subscribe? And what is the use case? compositeDisposable.add(get() .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) .subscribe(this::handleResponse,…
bastami82
  • 5,955
  • 7
  • 33
  • 44
51
votes
3 answers

Java Spring WebFlux vs RxJava

I’m starting to learn reactive programming in Java. The whole reactive paradigm is new to me. In my learning process, i have come across few terms/libraries such as Spring WebFlux, projectreactor, and RxJava. I hope someone can explain what the…
51
votes
2 answers

Why is RxJava often used with Retrofit?

What is the benefit of using Retrofit in combination with Rxjava?
Ranjithkumar
  • 16,071
  • 12
  • 120
  • 159
48
votes
2 answers

rxjava merge observables of different type

I'm new to rxjava. I need to combine two observables that emit objects of different type. Something like Observable and Observable and get a Observable. I couldn't find any operator for something like this. What would…
Jelly
  • 4,522
  • 6
  • 26
  • 42
47
votes
15 answers

Deliver the first item immediately, 'debounce' following items

Consider the following use case: need to deliver first item as soon as possible need to debounce following events with 1 second timeout I ended up implementing custom operator based on OperatorDebounceWithTime then using it like this .lift(new…
tomrozb
  • 25,773
  • 31
  • 101
  • 122
47
votes
1 answer

If the onComplete call is made for a RxJava Subject, do i have to manually unsubscribe again?

I'm using an RxJava ReplaySubject in my Fragment. I'm attempting to use the ReplaySubject in a way, where I would like the Subject to execute a process until completion (possibly beyond the life of the fragment). On completion of the process, I…
KG -
  • 7,130
  • 12
  • 56
  • 72
46
votes
5 answers

RxJava - fetch every item on the list

I have a method that returns an Observable>, which are ids of some Items. I'd like to go through this list and download every Item using another method that returns Observable. How would I do this using RxJava operators?
k_wisniewski
  • 2,439
  • 3
  • 24
  • 31
46
votes
6 answers

Observable which does not pass anything in onNext()

I would need an Observable, for example to provide a system clock, which does not need to pass anything in onNext(). I couldn't find a signature that would allow me to do that. Sure, I could use any object and then pass null, but that doesn't make…
Oliver Hausler
  • 4,900
  • 4
  • 35
  • 70
44
votes
4 answers

Kotlin quadruple, quintuple, etc. for destructuring

I am looking for a clean way to create destructurable objects in-line. kotlin.Pair and kotlin.Triple cover a lot of use cases, but sometimes there are more objects that are needed to be passed. One sample use case is RX's zip function, where the…
kenny_k
  • 3,831
  • 5
  • 30
  • 41