rx-java

How can I generalize the arity of rxjava2 Zip function (from Single/Observable) to n Nullable arguments without lose its types?

混江龙づ霸主 提交于 2020-07-19 04:40:10
问题 The bounty expires tomorrow . Answers to this question are eligible for a +500 reputation bounty. Damián Rafael Lattenero is looking for a canonical answer : Maybe it could be a generalisation of arity in methods requiring multiple typed arguments. Two Main Problems to solve: 1) Type check is lost Using the array argument Single.zip() version I lose the strongly typed arguments. 2) Source argument Cannot be Nullable I cannot send nullable source values as argument of Single.zip() function 3)

Are subscribers in Spring Reactor unbounded by default?

北战南征 提交于 2020-07-15 08:47:39
问题 I've been working in Spring Reactor and had some previous testing that made me wonder how Fluxes handle backpressure by default. I know that onBackpressureBuffer and such exist, and I have also read that RxJava defaults to unbounded until you define whether to buffer, drop, etc. So, can anyone clarify for me: What is the default backpressure behavior for a Flux in Reactor 3? I tried searching for the answer but didn't find any clear answers, only definitions of Backpressure or that answer

Are subscribers in Spring Reactor unbounded by default?

只愿长相守 提交于 2020-07-15 08:47:13
问题 I've been working in Spring Reactor and had some previous testing that made me wonder how Fluxes handle backpressure by default. I know that onBackpressureBuffer and such exist, and I have also read that RxJava defaults to unbounded until you define whether to buffer, drop, etc. So, can anyone clarify for me: What is the default backpressure behavior for a Flux in Reactor 3? I tried searching for the answer but didn't find any clear answers, only definitions of Backpressure or that answer

RxJava: Observable and default thread

强颜欢笑 提交于 2020-06-27 07:16:18
问题 I have the following code: Observable.create(new ObservableOnSubscribe<String>() { @Override public void subscribe(@NonNull final ObservableEmitter<String> s) throws Exception { Thread thread = new Thread(new Runnable() { @Override public void run() { s.onNext("1"); s.onComplete(); } }); thread.setName("background-thread-1"); thread.start(); } }).map(new Function<String, String>() { @Override public String apply(@NonNull String s) throws Exception { String threadName = Thread.currentThread()

RxAndroid download multiple files, max 3 concurrent thread

此生再无相见时 提交于 2020-06-27 04:04:29
问题 I have api to download single mp3 file from server,which is consumed using RxJava as bellow. Observable<ResponseBody> observable = audioService.getFile(fileNameWithExtension); observable.subscribeOn(Schedulers.newThread()) .observeOn(Schedulers.newThread()) .subscribe(someCallBackClass<ResponseBody>); This just downloads single file , callback saves the file on disk. I want to download list of files save each file on disk and wait till all download completes , At max 3 calls should be

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;

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

RxJava-file and operator chaining

好久不见. 提交于 2020-05-27 06:21:09
问题 I'm trying to reactively tail a log file using RxJava-File: File file = new File(".\\server.log"); Observable<String> newLines = FileObservable.tailer() .file(file) .startPosition(file.length()) .sampleTimeMs(1000) .chunkSize(8192) .utf8() .tailText(); newLines.subscribe(System.out::println); and it works as expected. But as soon as I try to chain some more operators, I get problems. For instance, changing to newLines.filter(LogfileWatcher::error).subscribe(System.out::println); (where error(

RxJava-file and operator chaining

老子叫甜甜 提交于 2020-05-27 06:19:09
问题 I'm trying to reactively tail a log file using RxJava-File: File file = new File(".\\server.log"); Observable<String> newLines = FileObservable.tailer() .file(file) .startPosition(file.length()) .sampleTimeMs(1000) .chunkSize(8192) .utf8() .tailText(); newLines.subscribe(System.out::println); and it works as expected. But as soon as I try to chain some more operators, I get problems. For instance, changing to newLines.filter(LogfileWatcher::error).subscribe(System.out::println); (where error(