rx-java

How to send array of objects in retrofit multipart request

倾然丶 夕夏残阳落幕 提交于 2021-01-27 13:42:13
问题 I want to send array objects with multipart data. I tried many ways but it is not working. My issue with the contributor parameter. Server says. contributor.0.id is required & contributor.0.role is required and so on for remaining items in the list. Server reads that there is a contributor array and it has items but he can't extract it for some reason. Any help please? @Multipart @POST("project/create") fun createProject( @Header("Authorization") token: String, @Part("title") title: String,

RxJava: how to handle combineLatest() when one of the streams emits nothing

痞子三分冷 提交于 2021-01-27 13:21:08
问题 I use combineLatest() to combine 3 streams of observables. All these are combined so that all data in the UI is shown at the same time. Now, there is a scenario in which one of the observables won't emit anything, since the data that gets fetched, can be null. Is there a RxJava operator to let the subscriber know that there won't be any emits because of null data? Edit private fun retrieveData() { Observable.combineLatest(getCurrentUser.execute(), getLatestGoal.execute(), getLatestLog.execute

Running histogram stream with Rx

有些话、适合烂在心里 提交于 2021-01-27 02:36:28
问题 I have the following single letter stream A B C A D B A C D And from this stream, I would like a stream of running count per letter (A,1) (A,1), (B,1) (A,1), (B,1), (C,1) (A,2), (B,1), (C,1) (A,2), (B,1), (C,1), (D,1) (A,2), (B,2), (C,1), (D,1) (A,3), (B,2), (C,1), (D,1) (A,3), (B,2), (C,2), (D,1) (A,3), (B,2), (C,2), (D,2) , i.e at each new letter, the totals are updated and emitted. I guess this problem is fairly language agnostic, so don't hesitate to propose a solution in your language of

Running histogram stream with Rx

元气小坏坏 提交于 2021-01-27 02:36:12
问题 I have the following single letter stream A B C A D B A C D And from this stream, I would like a stream of running count per letter (A,1) (A,1), (B,1) (A,1), (B,1), (C,1) (A,2), (B,1), (C,1) (A,2), (B,1), (C,1), (D,1) (A,2), (B,2), (C,1), (D,1) (A,3), (B,2), (C,1), (D,1) (A,3), (B,2), (C,2), (D,1) (A,3), (B,2), (C,2), (D,2) , i.e at each new letter, the totals are updated and emitted. I guess this problem is fairly language agnostic, so don't hesitate to propose a solution in your language of

Reactive and Non-Blocking Method Micronaut with apache kafka

守給你的承諾、 提交于 2021-01-19 08:29:49
问题 I am trying to get the Non-Blocking response from the Micronaut kafka implementation, however the return value in not working. public class ProductManager implements IProductManager{ private final ApplicationContext applicationContext; public ProductManager(ApplicationContext applicationContext) { this.applicationContext = applicationContext; } @Override public ProductViewModel findFreeText(String text) { final ProductViewModel model = new ProductViewModel(); IProductProducer client =

Reactive and Non-Blocking Method Micronaut with apache kafka

橙三吉。 提交于 2021-01-19 08:28:30
问题 I am trying to get the Non-Blocking response from the Micronaut kafka implementation, however the return value in not working. public class ProductManager implements IProductManager{ private final ApplicationContext applicationContext; public ProductManager(ApplicationContext applicationContext) { this.applicationContext = applicationContext; } @Override public ProductViewModel findFreeText(String text) { final ProductViewModel model = new ProductViewModel(); IProductProducer client =

How do I replace Asynctask with RxJava Observer?

你。 提交于 2021-01-07 02:29:46
问题 I have a test project with Room database. Using Asynctask I can successfully insert an object with some test data into the database. I'm trying to learn RxJava and replace Asynctask with RxJava's observer , but it doesn't work. I have read alot of documentation and watched tutorials, but I don't think I quite get it. Here's the relevant code: Here I set my Room object with the data from my List : for(ObjectForArray item: listToDatabase) { myRoomEntity.setName( item.getName() ); Log.d( "TAG",

How can I continue Rx chain different ways based on the property?

拥有回忆 提交于 2021-01-07 01:27:53
问题 I have a method where based on Flowable data value I need to continue RX chain different ways . what I mean is that if the isOnline property of data object is true then I need to call scan(initial,selector) but if it is false then I need to call scan(selector) @NotNull public Flowable<Data> initialCall( @NotNull Flowable<Info> info, Data initial) { return info .map() .switchMap(it -> call(Flowable.just(it),initial, it.isOnline)); } private Flowable<Data> call ( Flowable<A> a, Data initial,

How to pass on a traceId from gRPC's context to another thread/threadPool?

故事扮演 提交于 2021-01-01 05:05:43
问题 I am using grpc-java and have 3 services, A, B and C. I call service A and then service A calls B and C. I am using Hystrix in the calls to B and C. C in turn spawns another thread to call another service. I have ClientInterceptors and ServerInterceptors which passes around the traceId. I can see the traceIds in the Context and logs as long as it is a gRPC worker thread but lose them when the call moves to another thread - RxIoScheduler thread or Hystrix thread. How do I pass the traceId

How to pass on a traceId from gRPC's context to another thread/threadPool?

拟墨画扇 提交于 2021-01-01 05:04:46
问题 I am using grpc-java and have 3 services, A, B and C. I call service A and then service A calls B and C. I am using Hystrix in the calls to B and C. C in turn spawns another thread to call another service. I have ClientInterceptors and ServerInterceptors which passes around the traceId. I can see the traceIds in the Context and logs as long as it is a gRPC worker thread but lose them when the call moves to another thread - RxIoScheduler thread or Hystrix thread. How do I pass the traceId