Questions tagged [rx-java3]
The rx-java3 tag has no usage guidance.
143
questions
0
votes
1
answer
71
views
using Rxjava with flatmap not change the downstream data
RxJava3
Kotlin
I have the following method and I am trying to control the downstream to return the Pair<Customer, Profile> after the map operator
However, after the first flatMap the data is ...
0
votes
0
answers
12
views
RxJava - how to make dynamic api calls & add responses to list
I'm new to RxJava, using RxJava 3 to return a response that contains a dynamic number of urls that I then need to make GET requests to and then add those responses to a list that is to be observed by ...
0
votes
0
answers
44
views
How to block UI until Observable gets a response or timeout?
In my Android project I have a simple switch with a boolean interface to be imlemented later:
Switch (
text: String,
val isSwitchChecked: (Boolean) -> Unit
)
which I use like:
Switch("...
0
votes
1
answer
32
views
Room - Embedded object and the where clause with LiveData
This is sort of a continuation from my previous one, but I finally figured that one out (got rid of the duplication issue).
Android Room Relationship duplicating information
Customer table
@Entity(...
0
votes
1
answer
52
views
Multiple chained API calls to fetch data, but doOnNext of PublishSubject is never reached
I have a problem to understand a chained "RXJava-Retrofit" API call. I got inspired by this and implement this class named ObservationLoader to load the data from the API bucket per bucket. ...
0
votes
0
answers
36
views
Rxjava3 onNext method is executed after a long delay
I use the following code to realize the countdown display at the millisecond level. After onSubscribe is executed, the onNext method is executed nearly one minute later.
This problem occurs ...
0
votes
0
answers
22
views
Why Rxjava3 Observable on main thread miss sometimes while in doze mode?
I am using rxjava3 observable in foreground service to sync data after every 3 minutes but this observer miss sometime when phone in doze mode
disposable = Observable.interval(1, 3 * 60 * 1000, ...
0
votes
0
answers
18
views
Combining Rxjava with Webflux [duplicate]
I would like to know the way to combine Rxjava with Webflux in springboot. I am working on an application in which I am using Rxjava and I need to make implementation changes, from Single to Mono and ...
1
vote
0
answers
44
views
RxJava 3 - PublishSubject emit data after subscribe
I want to listen on relay and after subscribe emit first item on the same relay. So naturally I wrote:
val relay = PublishSubject.create<Int>()
relay
.doOnSubscribe { relay.onNext(1) }
....
0
votes
0
answers
22
views
How to efficiently skip thousands or millions of items with RxJava?
I'm trying to use RxJava to create an Observable (or Flowable) that gets its items from a database table. It should be considered a cold observable, in that each new subscriber can get all available ...
0
votes
1
answer
32
views
Insert in Room database missing values
I am using RxJava to do the background task and using java, android and its an old project. I am inserting the values in OnComplete in CompletableObserver which is in background thread inside a ...
0
votes
0
answers
39
views
RxJava zip operator failed to execute onComplete listener
I want to send multiple API requests, so I'm using RxJava's Zip operator, I want to know the success rate of the API requests to show it to the user, but here, whenever one request getting failed, I ...
0
votes
0
answers
44
views
In RxJava, wait until getting the all the responses from the Observable.zip()
I'm sending multiple API requests(>1000 requests) using Observable.zip(), see the below implementation, here I want to wait until the last responses arrive, I read the documentation for RxJava, but ...
0
votes
0
answers
26
views
Is there a bounded variant of UnicastProcessor?
The UnicastProcessor requests Long.MAX_VALUE elements on subscription and there is no way to set this while creating the processor.
I want to limit the number of requested items (to say 1) and only ...
0
votes
1
answer
311
views
Unable to create call adapter for io.reactivex.rxjava3.core.Observable<java.lang.Object>
I'm using Retrofit as a network client and sending Multiple APIs using RxJava's zip API, but when I create an instance for Retrofit, I got this error,
java.lang.IllegalArgumentException: Unable to ...
0
votes
0
answers
37
views
Using many write operations in RxAndroidBle creates a lot of disposables
I have the following code using an. RxAndroidBle Bluetooth Low Energy Connection:
private val connectionDisposable = CompositeDisposable()
private fun writeBle(writeCharacteristicUuid: UUID, command:...
1
vote
1
answer
13
views
RxJava Single display alertdialog
I feel like maybe what I am trying to do is the wrong way to do it, maybe it just isn't possible, or maybe my Google searching is just using all the wrong terms.
In my android app, I have the ...
0
votes
0
answers
31
views
How do you close a cold observable gracefully after certain time has elapsed from subscribe?
Assume below code which processes data from a paginatedAPI (external).
Flowable<Data> process = Flowable.generate(() -> new State(),
new BiConsumer<State, Emitter<Data>>() {
void ...
0
votes
2
answers
36
views
Custom expiry for replay() operator
I have a Observable<Snapshot> stream that when subscribed to, replays the event log of every Snapshot produced for every live entity (and any new Snapshot's after the subscription). This replay ...
1
vote
0
answers
126
views
How to use GroupBy, Buffer and Scan/Reduce in the same RxJava query
I have an infinite stream of data coming from my application. The event data looks like this:
@Builder
@EqualsAndHashCode
public class Event {
String Name;
String Type;
String Value;
}
In order ...
0
votes
0
answers
46
views
Maintaining cold observable semantics with a hot observable
I have a requirement to read items from an external queue, and persist them to a JDBC store. The items must be processed one-by-one, and the next item must only be read from the external queue once ...
0
votes
0
answers
297
views
Set null values into Preferences DataStore with rxjava
I create a method to set null values into Preferences Store with key, it works very well but when i debug looks a bit strange, it enter into a bucle when i try to get the null value.
This way is ...
1
vote
1
answer
47
views
How to make sure a database operation is completed before navigating to a different fragment
I'm learning more about RxJava (I know more about retrofit, but the company I work for does not use that unfortunately for me), and I'm trying to create a simple project with the room library and the ...
0
votes
0
answers
105
views
AsyncTask.THREAD_POOL_EXECUTOR deprecated API 30
I'm trying to implement the solution of this answer IdlingResource Espresso with RxJava but AsyncTask.THREAD_POOL_EXECUTOR is deprecated. What I should use instead?
0
votes
0
answers
13
views
Does ThrottleLast ignore the last emission in the last time interval slice? Why?
Situation
Trying to use throttleLast to capture some emissions. ex::
public static void demo_prototype__the_last_emission_is_not_capurted_by_throttleLast() {
Observable<String> source3 = ...
0
votes
0
answers
101
views
Rxjava crashing in release build with error "java.lang.AbstractMethodError: abstract method void io.reactivex.rxjava3.core.Observer.onSubscribe"
I have written a RxDownloader class to download items from a predefined list. The downloader is working fine when exporting as debug aar(sdk) file but getting crashed in relase build with following ...
0
votes
0
answers
39
views
How to handle Single<Single<String>> in RX?
I have an api with a method
fun getList(
@Path("array") array: String
): Single<List<EpisodeRetrofitModel>>
I need an argument to use this method. I get the ...
2
votes
1
answer
127
views
How do I check in an operator that current element is last element?
Context:
To process a Flowable<Item>, I need to first process the first item and then depending on that either accumulate all items into a single item (reduce) OR apply a simple map on each item ...
0
votes
0
answers
85
views
RxJava message on successful retry
How can I print message on successful retry while using retryWhen operator?
Let's say I have
Flowable.defer(() -> subscribe())
.retryWhen(error -> error.delay(5, TimeUnit.SECONDS))
...
0
votes
1
answer
73
views
RxJava subscribe only for specific key
I'm receiving an infinite stream of events, lets say Observable<Event> where Event(userId, payload). I have to provide functionality which allows subscribing users for their events. Observable&...
0
votes
1
answer
42
views
RxJava Grouped Flowable with Conflation
I' m trying to create a Flow for a fast producer with slow consumer for FX (foreign exchange) prices. The basic idea is that prices coming from the source should be sent to the consumer as fast as ...
0
votes
0
answers
41
views
What's the point of PublishSubject.onNext(Unit)?
Following PublishSubject is created:
val disposeUsage = remember { PublishSubject.create<Unit>() }
and immediately used as (a):
DisposableEffect(Unit) {
onDispose {
disposeUsage....
5
votes
1
answer
3k
views
How to convert a suspend function to an RX Single (or Completable)?
We're refactoring our project from RX to Kotlin Coroutines, but not in one go, so we need our project use both for some time.
Now we have a lot of methods that use RX single as a return type like this,...
0
votes
0
answers
56
views
how to use rxjava on three parallel polling events with timeout
There are three parallel polling events, polled every 200 milliseconds, and when one of the polls reaches the result, the three polling events stop, or stop after timeout 2s,How to achieve it using ...
0
votes
0
answers
229
views
Rx: zip List<Single<T>> to Single<List<T>>
Note: This problem is same for Observable, with more variations like combineLatest. So I've picked Single as the minimal example.
I routinely encounter situations where there is a list of sources of ...
1
vote
1
answer
1k
views
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 }) {
//..
}
....
0
votes
1
answer
50
views
RxJava: UndeliverableException when flatMap combined with switchMap
TL;DR
I think that flatMap combined with switchMap might not terminate the stream correctly, thus UndeliverableException happens. How can I fix this?
The Structure
I'm making a little bit complex ...
0
votes
1
answer
199
views
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("...
0
votes
1
answer
211
views
perform operation after each delay is complete in RxJava
I am trying to simulate the delay while emitting items in a specific sequence
Here I am trying to simulate the problem
List<Integer> integers = new ArrayList<>();
integers.add(1);
...
0
votes
0
answers
236
views
How to use RxJava inside Service in Android?
After parsing the JSON data with the help of Volley library, I want to save it to Room. Since the process was taking too long (about 45 seconds) I put this inside a Service. In the same way, I was ...
0
votes
1
answer
22
views
Correctly handling backpressure from an async call
I have some code that looks roughly like this:
Completable handle(Observable<Object> inbound) {
return inbound.buffer(1, TimeUnit.Second, 250)
.filter(l -> !l.isEmpty())
....
0
votes
0
answers
282
views
RxJava 3: How to use Futures with Observables/Singles
I'm relatively new to RxJava and I'm curious about how to use Futures with RxJava's Observable and/or Single. What I'm trying to make is a system to connect to a MongoDB database and load MongoDB ...
0
votes
0
answers
454
views
RxJava: How to subscribe to 2 observables in order and merge their result?
To set the stage, I have 2 network calls, the 2nd one depends on the result of the 1st.
fun netCall1(): Observable<Data1>{...}
fun netCall2(data: Data1): Observable<Data2>{...}
How do I ...
2
votes
0
answers
176
views
Unwanted garbage collection while calling from the method that ends
Spring Boot app, where Spring Boot's scheduled method calls RX method (rxjava3) to do the long job (in separate thread pool).
@Scheduled(fixedDelay = ONE_SECOND)
public void init() {
process()....
0
votes
1
answer
112
views
"JsonEOFException: Unexpected end-of-input" when sending a stream to a Rxjava2 endpoint
I'm trying to work out how to call to an endpoint that accepts a @Body parameter of Flowable<Integer>, to subscribe it to process the incoming stream (using Micronaut and the RxJava framework). ...
0
votes
0
answers
158
views
Rxjava error handling:App not crash after subscription ends
while learing rxjava/rxandroid i have came across one scenario. please help me to understand it.
please check below code.
val observable:Observable<Int> = Observable.create {
Log.d(...
1
vote
0
answers
135
views
RxJava Reduce Single's until some dynamic condition is met
Any RxJava experts that can help me figure this one out?
I have a function that returns a Single<ByteArray> based on some position parameter.
Basically, I want to keep calling that function, ...
-1
votes
1
answer
577
views
RxJava Run A Task on another thread
I'm using RxJava3 Observers and Observables. But i have a problem.
I have attached a screenshot below, please see the Toast on the bottom. I used Thread.currentThread().toString() And i got the Main, ...
1
vote
0
answers
161
views
How to work Rxjava3 with Retrofit foreground service asynchronous
I want to pull asynchronous json data with retrofit and rxjava 3 in the foreground service and show it to the user as a notification, but so far I have not been successful.
@Streaming
@GET("v2/...
0
votes
2
answers
2k
views
Problems with RXJava
I'm adapting some sample code from what3words for accessing their API via their Java SDK. It uses RXJava.
The sample code is:
Observable.fromCallable(() -> wrapper.convertTo3wa(new Coordinates(51....