Questions tagged [rx-kotlin2]

RxKotlin 2 is a library that adds convenient extension functions to RxJava.

RxKotlin 2 is a lightweight library that adds convenient extension functions to RxJava 2 (see ). It can be found at https://github.com/ReactiveX/RxKotlin

106 questions
2
votes
1 answer

share() operator not working for Observable in Rxjava

I have a scenario where we i have an emmiter which constantly emits data like this fun subscribeForEvents(): Flowable { return Flowable.create({ if…
Rajat Beck
  • 1,523
  • 1
  • 14
  • 29
2
votes
2 answers

How to use MockK to mock an observable

I have a data provider that has an Observable as part of the public API. My class under test maps this into a Observable. How do I create a mock so that it can send out different values on the data provider's observable? I can do it…
Jim Leask
  • 6,159
  • 5
  • 21
  • 31
2
votes
2 answers

Disposing of observables

This question is related to Android and life-cycles. Previously, I would have a series of subjects and subscribe to them on creation. Upon destruction, I would mark all the subjects as complete, assuming that it disposes all subscribers. With…
Allan W
  • 2,791
  • 4
  • 23
  • 41
2
votes
1 answer

How to use await method inside a flatMap?

my problem is this. I have the next code Observable.fromIterable(this) .flatMap { project -> val date = async(CommonPool) { App.db.projectResponseDao().getLastUpdate(project.uid.toString()) …
2
votes
1 answer

How to implement different kinds of return to the same query using Room and Android Rx?

I'm facing this problem. Im using room to create the local database of my app. Let's say i have an Entity call User and a UserDao. It looks like this: @Dao interface UserDao: BaseDao{ @Query("SELECT * FROM user WHERE remote_id =…
2
votes
2 answers

RxJava: Combining hot and cold observable to wait for each other

I have my observables defined like this val initLoading = Observable.fromCallable { println("${System.currentTimeMillis()}") } .subscribeOn(Schedulers.computation()) .delay(WAIT_TIME, TimeUnit.SECONDS) .map {…
1
vote
0 answers

How to create a stopwatch with Rx counting down to 0?

How can I create a stopwatch with Rx in Kotlinv with Observables, so anything can subscribe to it: It shall remain even when I put the app in background I start the Observable with anything I configure: 9000 [ms], 600 [s], etc. It counts down to 0…
Ralf Wickum
  • 2,850
  • 9
  • 55
  • 103
1
vote
1 answer

Available doOnError{} did not solve The exception not handled due to missing onError handler in the subscribe()

I have a PublishSubject: subjectA = PublishSubject.create() whoch is then operated similar to: subjectA .flatMap { //.. } .flatMapUntil({ it }) { //.. } .observeOn(AndroidSchedulers.mainThread()) .filter {…
Ralf Wickum
  • 2,850
  • 9
  • 55
  • 103
1
vote
0 answers

Combine empty list with other items in RxJava

I'm trying to combine multiple observables into one with the following code: val observables: Array> = arrayOf( obs0, obs1 obs2, obs3, obs4.flatMap { Observable.fromIterable(it) }, obs5, obs6, …
Ilya E
  • 700
  • 7
  • 13
1
vote
1 answer

RxKotlin COUNT with GROUP BY and return a list

I have a list of recurring elements in Kotlin, say: val result = arrayListOf("AA", "BB", "CC", "AA", "BB") I would like to group them by their value along with how many times they appear, so the output would be pairs of: {"AA", 2}, {"BB",…
user1154390
  • 2,331
  • 3
  • 25
  • 32
1
vote
1 answer

RxKotlin, RxJava: Observable/Single not starting

I have the following class, which exposes a Single to fetch an ID. This is used to fetch the ID on init of that class and later others can also use this to get the ID. Any where else from where I subscribe to this Single, I am able to get the ID.…
Sunny
  • 7,444
  • 22
  • 63
  • 104
1
vote
0 answers

Why do I get UndeliverableException

In the android app, the process goes like that: at first, I fetch notes from local SQLite and then make Http calls for each note. I use composite disposable to hold all disposables and release them when activity is destroyed. The code looks…
1
vote
3 answers

Unexpected NullPointException with RxKotlin when mapping optionals

To start I have the following Moshi json. @JsonClass(generateAdapter = true) data class OrderDetails( @Json(name = "_id") val id: Int, @Json(name = "status") val status: String, @Json(name = "tableNo") val tableNo: Int, @Json(name =…
Evan Anger
  • 712
  • 1
  • 5
  • 24
1
vote
1 answer

How to handle a multiple singles?

I'm writing messenger server on grpc with rxjava2 stubs, and I stuck on combining my singles. I'm have tried some sort of val user:Single = getUser() val conversation:Single = getConversation(user.blockingGet()) return…
teheidoma
  • 13
  • 2
1
vote
1 answer

What's the behavior of onBackpressureBuffer in RxJava2

What I wanted to do is to have a Flowable with a backpressure buffer of one item that keeps the latest one produced from a stream. I've tried to use Flowable.onBackpressureBuffer(1, () -> {}, BackpressureOverflowStrategy.DROP_OLDEST). However, it…
Feng Yang
  • 67
  • 5