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
1
vote
1 answer

Combine two subject only when one changes and get latest from other

Im stuck getting the following example working as expected, I have tried using zip and combineLatest and as show below withLatestFrom however non of them gives the expected output. @Test fun thereCanBeOnlyOne() { val s1 =…
user3139545
  • 6,882
  • 13
  • 44
  • 87
1
vote
2 answers

Change observable on condition met - RxJava2

Using RxJava2 RxKotlin and Room, I need to query the database for an open hunt. That means that I search for a hunt that contains an attribute called closed with value false. Once the hunt has been found, it needs to switch the query to that…
David Corsalini
  • 7,958
  • 8
  • 41
  • 66
0
votes
2 answers

Combine Singles and generate a data class Single

I have a question around Single and haven't been able to find a good answer for that yet. I have to return a Single from a method where I get 2 Single sources. The problem is I need to use the output of the 2 singles to modify a class and then send…
0
votes
0 answers

Server connection status with RxJava in Android

I have a websocket connection object StompWrapper { private var emitter: ObservableEmitter? = null init { val client = OkHttpClient.Builder().build() val stomp = StompClient(client) stomp.connect() …
iormark
  • 23
  • 4
0
votes
1 answer

Chain of RxJava calls

I am new to RxJava. I am struggling with chaining multiple API calls. The class structures are as follows: Location(location_id, location_name) Hub(hub_id, hub_name, location_id) Room(device_id, room_id, room_name) LocationList is defined…
chelsea
  • 185
  • 1
  • 10
0
votes
1 answer

Observable.never() in "non testing" production code and it is not disposed explicity?

Following is coded: PublishSubject.create .doOnNext{ //.. } .debounce { if (timeout > 0) Observable.timer(timeout, TimeUnit.MILLISECONDS) else Observable.never() } As it can be seen, there is an…
0
votes
1 answer

How to extend Observables.combineLatest() with fourth source?

Imagine there are two BehaviourSubject with Strings: private val subjectLocationA = BehaviorSubject.createDefault("London") private val subjectLocationB = BehaviorSubject.createDefault("Paris") were I update location each…
Ralf Wickum
  • 2,850
  • 9
  • 55
  • 103
0
votes
1 answer

Android BLE RxKotlin

I'm trying to create a BLE service that will scan for devices and using rxKotlin create an observable that will allow another class to observe when a device is found. I'm confused on how to create the observable that will allow another class to…
Ubarjohade
  • 471
  • 6
  • 21
0
votes
1 answer

How to collect every observable emittion into one object in rxJava2/rxKotlin2?

Observable emits trade objects. How to make operation on each emission into one result object? Trade(tradeType: String, profit: BigDecimal) Result(totalProfit: BigDecimal) Example: trades .scan(result: Result, currentTrade: Trade){ …
kaMChy
  • 441
  • 5
  • 9
0
votes
1 answer

How to call a method multiple times using RxJava's method retryWhen?

I have a method which perform network request and return Observable with mutable list of data class. Sometimes this method fails with 403 error. I need call YouTubeClient.getApiKey() method for getting new Api key and repeat request to network. How…
user14618921
0
votes
3 answers

RXKotlin - How to receive single event

I am getting callback event from an object twice sometime thrice but I need to collect only one object that will be the latest one. Is it possible with RX kotlin?
0
votes
1 answer

RxJava/RxKotlin: Wait for value to be fetched async and then provide to all subscribers

I have a scenario where I have to fetch some string asynchronously. I would like to create a method where I can listen to when this value is fetched successfully and then provided to the listener. Now, this can be done easily via many ways including…
Sunny
  • 7,444
  • 22
  • 63
  • 104
0
votes
1 answer

How to handle exception when doing request to external service and return status accordingly in Micronaut filter

So I'm completely new to rx-java/rx-kotlin and haven't heard about it until I where to write a HTTP filter in Micronaut (https://docs.micronaut.io/latest/guide/index.html#filters) which caught me off guard since I've only done regular JAX-RS…
0
votes
1 answer

Order of events received by subscribers of a Publish Subject

I have a publish subject with multiple subscribers: Here is the class: class Real { private val publisher: PublishSubject = PublishSubject.create() fun doPublish() { for (i in 1 until 20) { …
User3
  • 2,465
  • 8
  • 41
  • 84
0
votes
1 answer

How to make the map wait till the current index item is finished processing and then take the next item for processing using RxJava?

I'm trying to convert the input streams into the file. So when user selects 1 image, it all works well. But when user selects multiple images, for example 4 then the below code is not working as expected; I see only 2 files path in Log statement.…
Aniruddha
  • 4,477
  • 2
  • 21
  • 39