rx-java2

Why in multiple connections to PricesResource Publisher, only one gets the stream?

核能气质少年 提交于 2020-06-17 09:33:10
问题 It seems that only one http client gets the stream of data, while the others do not. Is it true that the Publisher is hot data, and that it should broadcast to all subscribers? Please find more in Can I allow multiple http clients to consume a Flowable stream of data with resteasy-rxjava2 / quarkus? package org.acme.kafka; import javax.inject.Inject; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import io.reactivex.Flowable;

How to return a Rx Single transaction using Room Db?

故事扮演 提交于 2020-06-16 02:00:02
问题 Suppose there is a Dao class with the following two methods: 1) delete(items: List<Item>): Completable 2) insert(items: List< Item >): Single<List<Long>> How can I chain them into a @transaction method in Dao class starting with ‘delete method’ and then returning ‘insert method’ result? I want to have a method with a signature like this: @Transaction fun deleteAndInsert(): Single<List<Long> > { ... } 回答1: I'm assuming your main goal is to have the return type of deleteAndInsert() as Single .

How to return a Rx Single transaction using Room Db?

♀尐吖头ヾ 提交于 2020-06-16 01:56:08
问题 Suppose there is a Dao class with the following two methods: 1) delete(items: List<Item>): Completable 2) insert(items: List< Item >): Single<List<Long>> How can I chain them into a @transaction method in Dao class starting with ‘delete method’ and then returning ‘insert method’ result? I want to have a method with a signature like this: @Transaction fun deleteAndInsert(): Single<List<Long> > { ... } 回答1: I'm assuming your main goal is to have the return type of deleteAndInsert() as Single .

Can I allow multiple http clients to consume a Flowable stream of data with resteasy-rxjava2 / quarkus?

大城市里の小女人 提交于 2020-05-30 09:49:20
问题 Currently I am able to see the streaming values exposed by the code below, but only one http client will receive the continuous stream of values, the others will not be able to. The code, a modified version of the quarkus quickstart for kafka reactive streaming is: @Path("/migrations") public class StreamingResource { private volatile Map<String, String> counterBySystemDate = new ConcurrentHashMap<>(); @Inject @Channel("migrations") Flowable<String> counters; @GET @Path("/stream") @Produces

Can I allow multiple http clients to consume a Flowable stream of data with resteasy-rxjava2 / quarkus?

丶灬走出姿态 提交于 2020-05-30 09:48:38
问题 Currently I am able to see the streaming values exposed by the code below, but only one http client will receive the continuous stream of values, the others will not be able to. The code, a modified version of the quarkus quickstart for kafka reactive streaming is: @Path("/migrations") public class StreamingResource { private volatile Map<String, String> counterBySystemDate = new ConcurrentHashMap<>(); @Inject @Channel("migrations") Flowable<String> counters; @GET @Path("/stream") @Produces

Room - Delete executes after I insert new values

偶尔善良 提交于 2020-05-25 07:17:46
问题 I'm studying Rxjava2 and I'm trying to integrate the Room Library with Rxjava2. The problem is: I have a populated table and every time I login in the app, I need to delete this table and then insert a new content in database. Separately, the delete and insert works fine, but when I try to insert new values after I delete the table content, the delete method deletes all the new values.. (some parts of the code is in kotlin and others in java) I already tried this: RxJava2 + Room: data is not

Room - Delete executes after I insert new values

僤鯓⒐⒋嵵緔 提交于 2020-05-25 07:17:14
问题 I'm studying Rxjava2 and I'm trying to integrate the Room Library with Rxjava2. The problem is: I have a populated table and every time I login in the app, I need to delete this table and then insert a new content in database. Separately, the delete and insert works fine, but when I try to insert new values after I delete the table content, the delete method deletes all the new values.. (some parts of the code is in kotlin and others in java) I already tried this: RxJava2 + Room: data is not

Room - Delete executes after I insert new values

让人想犯罪 __ 提交于 2020-05-25 07:17:08
问题 I'm studying Rxjava2 and I'm trying to integrate the Room Library with Rxjava2. The problem is: I have a populated table and every time I login in the app, I need to delete this table and then insert a new content in database. Separately, the delete and insert works fine, but when I try to insert new values after I delete the table content, the delete method deletes all the new values.. (some parts of the code is in kotlin and others in java) I already tried this: RxJava2 + Room: data is not

How to use flatMap in Android RxJava to make three web service call sequentially without using lambda function?

烂漫一生 提交于 2020-05-14 18:26:07
问题 My API Client public class ApiClient { public static final String BASE_URL = "http://baseurl.com/wp-json/"; private static Retrofit retrofit = null; public static Retrofit getClient() { if (retrofit==null) { retrofit = new Retrofit.Builder() .baseUrl(BASE_URL) .addCallAdapterFactory(RxJava2CallAdapterFactory.create()) .addConverterFactory(GsonConverterFactory.create()) .build(); } return retrofit; } } My endpoint interface public interface ApiInterface { @GET("posts/category/politics/recent

InterruptedException not caught on RxJava onError callback? [duplicate]

邮差的信 提交于 2020-05-14 11:23:49
问题 This question already has an answer here : How to handle dispose in RxJava without InterruptedException (1 answer) Closed 5 days ago . I have a simple code below compositeDisposable.add(Observable.create<Int> { Thread.sleep(1000) } .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe({}, {Log.d("Track", it.localizedMessage)}, {})) Handler().postDelayed({compositeDisposable.clear()}, 100) It purposely use Thread.sleep(1000) , just to trigger the