Questions tagged [rx-java3]

149 questions
0
votes
2 answers

Calling dispose() when passing a subscriber that overrides onSubscribe

I am new to RxJava and if I understand correctly the Observer is passed the Disposable on the onSubscribe so it can manually stop the processing if the dispose() has already been called. I created the following code: @NonNull Observable src =…
Jim
  • 3,845
  • 3
  • 22
  • 47
0
votes
1 answer

com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 148 path $.main

i have problem and really don't know how to fix this. I try to find similar posts several days, but didn't find. I use retrofit for parsing api and put it in room database and use rxjava3 because it will be asynchronously That my JSON { "coord":…
0
votes
1 answer

Are subscribers notified after all events or per event?

I am new into RxJava and I was under the impression that for each event each subscriber is being notified. So if we have N subscribers and a stream of X events the onNext for each of the N subscribers would be called. But when I run the following…
Jim
  • 3,845
  • 3
  • 22
  • 47
0
votes
0 answers

RxJava Observable across fragments using shared ViewModel

I have an Activity that kicks off three fragments. The first is a loading splash screen where I just want to show the name of the app for a couple seconds. The second, in my current case, is a screen that gathers the users name and language. The…
sacredfaith
  • 850
  • 1
  • 8
  • 22
0
votes
1 answer

RxJava BehaviorSubject#onError(Throwable) equivalent in Kotlin Flow

I'm converting some RxJava code to Kotlin Flow in a project. I came across a piece of code where BehaviorSubject#onError(Throwable) was being called. I didn't find any way to do it with a Flow object. // RxJava val behaviorSubject =…
Augusto Carmo
  • 4,386
  • 2
  • 28
  • 61
0
votes
1 answer

RxJava takeWhile seems ignored. Should only execute for the first page

I am trying to upload database entities in batches using workmanager. The work fires alright, however the service doing the paging doesn't work as expected. What I would like to do: Paginate through the database entries I need to upload (last…
szab.kel
  • 2,356
  • 5
  • 40
  • 74
0
votes
2 answers

How to emit an item while waiting another Flowable to emit

I'm using RxJava3 and I have the following code setup where I want to emit an item in the middle, between the first and second flowable. Is there a way to do it? firstFlowable.firstElement() //I want to emit an item here .flatMap {…
kemenesendre
  • 165
  • 1
  • 1
  • 11
0
votes
1 answer

RxJava receive data packets from multiple source and write to OutputStream with delay between each packet

I have Java TCP client Socket reading InputStream and distributing data packets to various parts of the application via RxJava PublishSubject. This works. Also sometimes I write to OutputStream. Commands are converted into single data packet(byte[])…
AvengerX
  • 25
  • 7
0
votes
1 answer

RxJava: When "The Observable Contract" says "happens-before", what does it actually mean?

The Observable Contract Observables must issue notifications to observers serially (not in parallel). They may issue these notifications from different threads, but there must be a formal happens-before relationship between the notifications. When…
0
votes
0 answers

Print Elements on buffer, Flowable rxJava

How to print elements in buffer when using backpressure: Flowable.range(1, 1000) .onBackpressureBuffer(20, () ->{}, BackpressureOverflowStrategy.DROP_OLDEST) .onBackpressureDrop(v -> System.out.println("Dropped.. :"…
Brahian
  • 46
  • 1
  • 5
0
votes
1 answer

Error when returning Single using Room @Insert method

I am trying to use RxJava and return a Single when an insert to my room database is successful, but I have the following error when compiling: Not sure how to handle insert method's return type. Single insert(List obj); This…
mantc_sdr
  • 451
  • 3
  • 17
0
votes
1 answer

RxJava 3 Mapper

I am using RxJava3 in my project and I can't write a request, I've been wrestling my head for several hours. I have List and have a function that returns a Single> by Stream, i want to get a Single>>, fun…
0
votes
2 answers

RxJava's retryWhen unexpectedly keeps retrying forever

Can anyone … explain why the following code keeps retrying indefinitely, once retryWhen is called? correct the code to stop retrying when Random.nextBoolean() returns true? I think there is a 50% chance that retryWhen is called because of…
Tatsuya Fujisaki
  • 1,434
  • 15
  • 18
0
votes
0 answers

Wrong behaviour for CircuitBreaker in Micronaut

Have a controller: @Controller @CircuitBreaker public class ExampleController { @Get("/") public Single endpoint() { return Single.fromSupplier(this::serviceCall); } private String serviceCall() { throw new…
0
votes
1 answer

Random processing of retrofit2 requests

I get a list of the index composition (102 tickers) and I want to find out detailed information about them, but out of 102 queries, no more than 10 are always executed, and the ticker is randomly selected. All requests are executed via retrofit2…
Melowetty
  • 1
  • 1