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
3
votes
3 answers

Exception handling in rxjava

I am trying to get accustomed to rxjava and I am trying to call the below QuoteReader in an Observable. I am not sure how to handle the exception thrown, public class QuoteReader { public Map getQuote() throws IOException{ …
g0c00l.g33k
  • 2,458
  • 2
  • 31
  • 41
3
votes
1 answer

RxJava observable: Invoke onError and then retry

I'm currently using retry() to re-subscribe to my Observable if an error occurs. In this way my Subscriber's onError is not called: there is a way to let onError be called and THEN re-subscribe to the Observable?
brescia123
  • 517
  • 6
  • 23
3
votes
1 answer

concatMap, flatMap, switchMap for a single item

I know the differences between concatMap, flatMap and switchMap, but what if my stream only emits a single item and completes? In this case, functionally (pun not intended) these two operators are the same, but what about the performance? Which…
DariusL
  • 4,007
  • 5
  • 32
  • 44
3
votes
1 answer

Pausable BehaviorSubject?

Is it possible to have a kind of BehaviorSubject with pause and resume switches? Something like PausableBehaviorSubject.pause() and PausableBehaviorSubject.resume()? How could that be done? The idea is that, when paused, the subject would not…
Eduardo Bezerra
  • 1,923
  • 1
  • 17
  • 32
3
votes
1 answer

how to escape this callback hell using RxJava

subscriptionSet = provider.removeGeofences(mGeofencePendingIntent).observeOn(AndroidSchedulers.mainThread()).subscribe(new Subscriber() { @Override public void onCompleted() { } @Override …
Ofek Ron
  • 8,354
  • 13
  • 55
  • 103
3
votes
1 answer

RxJava - get a list, operate on its items, group into list again. toList() waits for onCompleted()

I want to get all unsynchronised items from my database every time they appear there, try to synchronise them to the backend and then write to the database, that they are synchronised. To perform this I make this chain of operations (with RxJava…
Michał Klimczak
  • 12,674
  • 8
  • 66
  • 99
3
votes
1 answer

RxJava: CountDownLatch never stop

Recently, I'm learning RxJava. We all know CountDownLatch will stop when counting to zero. Well, but when I run code below, CountDownLaych never stop! And I try to run same code as Java project, it's ok to stop! @Override protected void…
HuangDong.Li
  • 291
  • 1
  • 2
  • 9
3
votes
1 answer

RxJava resilent way to combine multiple observables

I have multiple modules that return Observables: O1, O2, O3... On The result of all modules should be combined into one observable Ocomb so that individual tasks can fail but the combination is not terminated or influenced by individual issues. With…
Philipp
  • 433
  • 3
  • 14
3
votes
2 answers

Does RxJava's onBackpressureDrop() drop items?

I tried below. public static void main(String[] args) throws Exception { Observable.interval(100L, TimeUnit.MILLISECONDS) .onBackpressureDrop().subscribe(new Subscriber() { @Override public void onStart() { request(1L); …
otal
  • 391
  • 2
  • 15
3
votes
1 answer

spring mvc integrate with reactive stream

i have a RESTful api application build on spring mvc. recently i was doing something integration between spring mvc and reactive stream (like rxjava and project-reactor) and try to make the application more reactive. i have just build some demo like…
3
votes
1 answer

RxAndroid crashes the app although doOnError is implemented

I have the following code. It's basically an attempt to send all data from a specific SQLite table to DynamoDB: Observable.create(new Observable.OnSubscribe() { @Override public void call(Subscriber subscriber) { …
pstobiecki
  • 1,804
  • 1
  • 17
  • 30
3
votes
1 answer

Transform HashMap values using RxJava

Is there a some way, by 'way' I mean using rx operators, to transform each HashMap value (setting the hashmap key as a value field) and get into a new Hashmap or ArrList? Observable> observable =…
DaniloDeQueiroz
  • 412
  • 4
  • 18
3
votes
2 answers

After Reactive Streams Specification 1.0 released, will jdbc specification go reactive as well?

I was learning and using reactive streams programming with akka streams, I was trying to find any libraries for an async-jdbc-driver or reactive-jdbc-driver for 2 years, and I found slick 3.0 or rxjava-jdbc-driver provide async jdbc api, but I know…
3
votes
2 answers

What are the differences in the implementation of Schedulers.computation and Schedulers.io?

Why they are used for different kinds of task? What make them different when handling computational task vs io task ? Schedulers.computation( ) - meant for computational work such as event-loops and callback processing; do not use this scheduler…
Xitrum
  • 7,765
  • 26
  • 90
  • 126
3
votes
1 answer

RxJava allow multiple onError calls

I'm attempting to allow for an infinite stream of both on next and on error calls. The below code uses the retry() method which I assumed would allow me to see all 3 calls to onNext however after the error nothing else is called. public class…
Numan1617
  • 1,158
  • 5
  • 19