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.
6,854
questions
1
vote
0
answers
8
views
Do we need Jack to use Java 8 features to make a build using Android.mk?
So I have a Android.mk and I was trying to make a build for Android 8.1 where I was using RxJava but while building it, I was getting the error "" Lambda coming from jar file need their ...
0
votes
1
answer
21
views
RxJava real World Usecase Scenario
Currently im learning how to use RxJava. I fully understand the concept of the reactive Programming paradigma where the programm needs to react to certain types of changes (Userinputs, Sensordata, etc....
0
votes
0
answers
9
views
io.reactivex.rxjava3.exceptions.CompositeException on Google Play Console
I'm getting below crash on Google Play Console for my app. But it hasn't highlighted any class of my app here. So, it's becoming hard to understand cause of the crash. This crash is coming very ...
0
votes
0
answers
16
views
Rx java response change?
I am new to rxjava this is what the api call function
Observable<JsonElement> call = mWebAPI.getClicktoCall(user_id,Record_id_separated2);
Disposable callProject = call.subscribeOn(...
0
votes
0
answers
14
views
How to Dispose an RxJava Scheduler.Worker (Scheduler.io) thread in SpringBoot application
Using RxJava I am running an API call asynchronously using Schedulers.io in a SpringBoot application:
Observable.fromCallable(() -> *API call code* )
.subscribeOn(Schedulers.io())
After that I ...
2
votes
1
answer
64
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
1
answer
20
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))
...
1
vote
0
answers
19
views
Can RxJava be used to send messages only to the most recent subscriber?
I've been given a requirement that when there are multiple observers, only the most recent subscription should receive messages. I'll illustrate with sloppy code examples.
val fooDisposable = ...
0
votes
0
answers
26
views
Repeat Rxjava chain
I am getting data then I am doing an async request to check flag and if it is false, I want to repeat this step for 5 times with 1 sec delay until it gets true and continue processing or throw ...
1
vote
0
answers
21
views
Rxjava polling with observable
I would need to do an API call every 1 second and keep retrying while the "status" is "in_progress". However, every time I do the API call, I would receive a new QR code which I'd ...
0
votes
0
answers
20
views
Writing JUnit tests for restTemplate.delete with Observable throwing OnErrorNotImplementedException
I have two methods in my Spring Boot(version 1.3.3) project as follows;
public Observable<Void> methodA() {
return this.methodB().map(s -> {
methodC.subscribe( aVoid ->
// some ...
0
votes
0
answers
18
views
WorkManager: FutureCallback always returns success no matter what result
I am doing this:
val fileUploadRequest = OneTimeWorkRequestBuilder<FileUploadWorker>().build()
Futures.addCallback(workManager.enqueueUniqueWork(this::class.simpleName!!, ExistingWorkPolicy....
0
votes
0
answers
35
views
RxJava 2 Zip/Combine/FlatMap operators
I'm trying to find a proper RxJava 2 operator for my specific need.
I have 2 server requests.
val singletonOne = repository.loadData(requestOne) // Returns Single
val singletonTwo = repository....
0
votes
1
answer
16
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
0
answers
30
views
Java reactive programming. Thread management fundamentals
I am learning Java RX Reactive programming. I am dwindled with a very basic question on the Asynch call that Java Reactive calls. So here is a scenario:
It is as follows:
input(a,b,c)
#1CPU op on a b ...
0
votes
0
answers
10
views
Is it a bad practice to declare Completable.complete as variable?
In different places of my class I have to return Completable.complete.
How bad will it be if I introduce variableCompletable someName = Completable.complete and use it instead of repeating this method ...
0
votes
0
answers
25
views
RxJava which operator to use
Is there any operator in RxJava to jump to the fetchAllParams(it) function if the filter operator returns false
That is, if UserAvailable.NOT_DETERMINED, I make a delay of 5 seconds and resend the ...
2
votes
1
answer
28
views
Wait until previous event finish Rx
In my code, I have events that need to be processed sequentially and others in parallel.
I managed to do the parallel part but I can't do the sequential version.
event.ofType(Message.class)
....
-1
votes
0
answers
16
views
When to use .dispose()
I have a blocking context that subscribes to Observable.(I know it is a bad practice, but that is how it is)
publis String someMethod(List<Entity> data) {
save(data);
return "success&...
2
votes
1
answer
88
views
How to pass Observable emissions to MutableSharedFlow?
well, I have an Observable, I’ve used asFlow() to convert it but doesn’t emit.
I’m trying to migrate from Rx and Channels to Flow, so I have this function
override fun processIntents(intents: ...
0
votes
1
answer
27
views
I want to convert AsyncTask to RxJava, but I don't know how to do it
The asynchronous operation is no longer available.
So I want to use RxJava instead.
However, no matter how much I search on Google, there is no way to convert it.
Among the 'Mainactivitie' that I ...
0
votes
0
answers
16
views
Why doOnSuccess can touch the ProgressBar even after set observeOn(Schedulers.io)
Why doOnSuccess can touch the ProgressBar even after set observeOn(Schedulers.io)?
...
.observeOn(Schedulers.io())
.doOnSuccess(mainDataModel -> view.setVisibility(View.VISIBLE))
I'm using Single ...
0
votes
0
answers
8
views
how to send a service request via instrument test (Android)
how to send a service request via instrument test
How can I test the service request you made with RxJava and retrofit with instrument test?
0
votes
0
answers
22
views
How to end a progress bar animation before max timeout with RxJava?
I have a custom progress bar which i pass the max progress as a parameter. It works properly when the timeout is reached completely. The thing is that i can receive the data before the timeout is ...
0
votes
1
answer
23
views
BackpressureStrategy.DROP not working as I expected
Let's suppose I have an activity showing the posts in RecyclerView and inside this activity, there is a refresh button.
When the user clicked on the refresh button I'll connect with the server to get ...
1
vote
1
answer
28
views
Is there equivalent of RxJava Completable in project reactor?
I don't want to return anything from my Mono, just wait for it to complete without errors. In RxJava I would use Completable, but what is recommended way of doing it in Project-Reactor?
0
votes
1
answer
28
views
Repeat using condition on infinite stream RxJava
i have the following infinite stream :
Observable<MyEvent> eventStream;
Many events are posted on this stream and it stop when the app stop.
I have 2 events that is need to listen:
MyEvent....
0
votes
1
answer
53
views
Why reactor does not process each element concurrently?
What I expect is reactor will create threads for each emitted element, meaning elements 1, 2, 3, 4, 5 from the source should be handled concurrently. But it's not true from my demo code output, but I ...
0
votes
0
answers
16
views
AbstractChannel$AnnotatedConnectException: Conexión rehusada
I am trying to connect with one activeMQ host using vertx (vertx client does not support failover, then I am trying do it manually):
And if the connection fail, I am trying to connect to second Host:
...
1
vote
0
answers
39
views
RxJava2 Observable.zip(list) executes Network calls twice
I'm getting an unwanted behavior/flaw when passing a list of Observable Network calls to Observable.Zip(), similar to this accepted answer:
How to make multiple request and wait until data is come ...
0
votes
1
answer
29
views
Is it possible in Rx java kotlin to remove timeout or abort observable on success
I have the following code, and when succesfully onNext is received after 5 minutes I am receiving onError as there is timeout, so how can I disable timeout or abort disposable to not call ...
0
votes
1
answer
14
views
RxJava: Combine 2 lists, ignoring missing items in list 2
I have two lists of objects, RemoteList and LocalList.
While my app is offline, remote users can be adding and deleting objects from the RemoteList while local users are editing the LocalList.
When ...
0
votes
1
answer
27
views
Cleanest way to dispose of Single subscriptions
I'm using RxHttpClient to make requests and return Single using .firstOrError(). I then subscribe to it to get the result. In order to dispose of that subscription, I used a CompositeDisposable like ...
-1
votes
0
answers
20
views
How can I connect with the server using Retrofit without creating multiple instances?
button.setOnClickListener(view1 -> new Retrofit.Builder()
.baseUrl(BASE_URL)
.addCallAdapterFactory(RxJava3CallAdapterFactory.create())
.build().create(...
0
votes
0
answers
24
views
How to use PublishSubject with retryWhen method?
PublishSubject<Object> publishSubject = PublishSubject.create();
-----
Retrofit...
.retryWhen(throwableFlowable -> //What can I do here?)
-----
retryButton.setOnClickListener(view1 -> ...
0
votes
1
answer
51
views
SkipWhile method does not work as I expected in RxJava
boolean isRetryButtonClicked = false;
.retryWhen(throwableFlowable -> throwableFlowable.skipWhile(throwable -> !isRetryButtonClicked)
.doOnNext(throwable -> Log.w("...", "...
0
votes
0
answers
30
views
RxJava - unit test for specific parallel execution
I have the following piece of code that I want to test:
class Repository(
private val db: Database,
private val api: Api,
private val ioScheduler: Scheduler
)
fun dbOperationOne() {
...
0
votes
0
answers
16
views
Close rx stream basing on amount of passed data by another stream
I have an infinite stream:
someIntStream: Observable<Int>
and I'd like to expose a function with following signature:
fun retrieveInts(numberOfIntsToRetrieve: Int): Observable<Int>
, which ...
0
votes
0
answers
27
views
Testing viewModel with liveData and rxJava actual array was <null>
I want to ensure that after viewModel method is called liveData has a value. Had a problem with liveData.getValue() which is always null while testing viewModel with rxJava Single.
Error messages(...
0
votes
1
answer
103
views
How to do API call in for loop in android?
How we can perform same API call in for loop of array list of object :
private var emergencyContacts: ArrayList<Contact> = ArrayList()
emergencyContacts.forEach
{
...
0
votes
1
answer
83
views
Null pointer exception when running viewmodel test using liveData and rxJava Single
I want to cover ViewModel with unit tests. But getting NullPointerException when running them.
ViewModel implementation is as follows:
interactors and Schedulers are injected through the constructor
...
0
votes
1
answer
14
views
Kotlin error when fetching API with RxJava
So I'm new to kotlin, and I'm trying to fetch API with RxJava by following this tutorial https://www.youtube.com/watch?v=VObSnk5jrpc&list=PLRRNzqzbPLd906bPH-xFz9Oy2IcjqVWCH&index=6
But I got ...
1
vote
1
answer
22
views
RxJava how to accept at most 5 items for any subscription
In RxJAVA we can replay old entries to new subscribers. I would like to know if there is a mechanism that I can replay parametric number of entries to subscribers.
Subscriber<String> ...
1
vote
0
answers
76
views
How to use Paging 3 library with RxJava 3 on Jetpack Compose
At Jetpack Compose documentation, it says that use collectAsLazyPagingItems() to get LazyPagingItems, and pass to LazyColumn's items.
The problem is; collectAsLazyPagingItems() function only works in ...
0
votes
1
answer
42
views
How can I recheck every 1 second using RxJava?
Is there any method in RxJava to recheck if the variable is null or not, For example, Recheck every 1 second or when the value is given to the variable?
String x;
Completable.create(emitter -> {
...
0
votes
1
answer
36
views
Can I delay the onSuccess method in RxJava?
I have SplashScreenFragment and inside this fragment, I'll load the data from the server using Retrofit with RxJava, Getting data from the server will take between 1 second to 25 seconds.
The ...
0
votes
1
answer
123
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
1
answer
69
views
Could not find io.reactivex.rxjava2:rxandroid:2.2.20
This is my project and I am trying to use this rxjava library. At the beginning, I added the required dependencies it is being synced without any fault but when I rebuilt the project it did not work. ...
0
votes
0
answers
19
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
1
answer
14
views
Rxjava newbee question around chosing an observable
Have a problem that I cant seem to figure out a good solution for. I have 2 observables that I am trying observe on. During a session only 1 will spit out information while the other will throw an ...