reactive-programming

C# .NET Rx- Where is System.Reactive?

有些话、适合烂在心里 提交于 2019-12-03 10:40:47
问题 I have an intensive Java background so forgive me if I'm overlooking something obvious in C#, but my research is getting me nowhere. I am trying to use the reactive Rx .NET library. The compiler is not complaining about the IObservable but it is with the call to the zip method. It is throwing the "... are you missing a using directive or assembly reference?" I've been going through the namespaces and I cannot find what is looking for. I cannot find the System.Reactive which also throws an

Unexplainable lack of performance improvement using RxJava Observables in Web Applications

拥有回忆 提交于 2019-12-03 10:38:05
I am performing some tests to evaluate if there is a real advantage in using reactive API's based on Observables, instead of the blocking traditional ones. The whole example is available on Githug Surprisingly the results show that the thoughput results are: The best : REST Services that return a Callable / DeferredResult that wraps the blocking operations. Not that bad : Blocking REST Services. The worst : REST Services that return a DeferredResult whose result is set by a RxJava Observable . This is my Spring WebApp: Application : @SpringBootApplication public class SpringNioRestApplication

How do I create a ReactiveCocoa subscriber that receives a signal only once, then unsubscribes/releases itself?

别来无恙 提交于 2019-12-03 10:08:32
I'm currently registering a subscriber to a property signal like this: [RACAble(self.test) subscribeNext:^(id x) { NSLog(@"signal fired!"); }]; The default functionality is that it fires every single time self.test is changed, but I just want it to fire once, and then unsubscribe. Is there a "once" argument or modifier I can pass to RAC when I create this subscriber? [[RACAble(self.test) take:1] subscribeNext:^(id x) { NSLog(@"signal fired!"); }]; That might be helpful especially when you create nested subscriptions: RACDisposable *subscription = [RACObserve(self, test) subscribeNext:^(id x) {

How to convert rxJava2's Observable to Completable?

左心房为你撑大大i 提交于 2019-12-03 09:38:41
I have Observable stream, and I want to convert it to Completable, how I could do that? The fluent way is to use Observable.ignoreElements() . Observable.just(1, 2, 3) .ignoreElements() Convert it back via toObservable if needed. You can do something like below. Observable<Integer> observable = Observable.just(1, 2, 3); Completable completable = Completable.fromObservable(observable); Like on an Observable, you will have to subscribe to the completable to start the asynchronous process that Observable wraps. More details can be found here in the Java doc for the method . As I understand all

What is the difference between Dataflow programming and Reactive programming?

核能气质少年 提交于 2019-12-03 09:27:09
问题 I really can't see the difference between them. They are both about data flowing through instructions and the propagation of changes in the input data. I've read this book (authored by Matt Carcki) and it clearly says that the are both the same. On the other hand the wikipedia establish Reactive programming as a form of Dataflow programming and this stackoverflow answer does it too. So, what is the conceptual difference between Reactive programming and Dataflow programming? 回答1: Reactive

Asynchronous RestAPIs with RxJava/Jersey2. Threading questions?

余生颓废 提交于 2019-12-03 09:08:00
We are in the process of prototyping a REST API using reactive programming. As shown in the diagram, we keep 3 layers same as we used in our previouse sync API designs ; http://oi59.tinypic.com/339hhki.jpg API Layer implemented using Jersey2 which will process request/deserialize JSON and handover to Service Layer. Service Layer which implements the business-logic.Implemented using reactive programming (RxJava) Dao Layer which is used for persistence operations by Service Layer.Since we use CouchBase , this will use CouchBase RxClient. To my understanding the flow is as follows : a) HTTP

Does scala offer async non-blocking IO when working with files?

孤街醉人 提交于 2019-12-03 08:14:56
I am using scala 2.10 and I wonder If there is some package which has async IO when working with files? I did some search o this topic but mostly found examples as following val file = new File(canonicalFilename) val bw = new BufferedWriter(new FileWriter(file)) bw.write(text) bw.close() what essentially essentially java.io package with blocking IO operations - write, read etc. I also found scala-io project with this intention but it seems that project is dead last activity 2012. What is best practice in this scenario? Is there any scala package or the common way is wrapping java.io code to

Mono vs CompletableFuture

主宰稳场 提交于 2019-12-03 07:58:16
CompletableFuture executes a task on a separate thread ( uses a thread-pool ) and provides a callback function. Let's say I have an API call in a CompletableFuture . Is that an API call blocking? Would the thread be blocked till it does not get a response from the API? ( I know main thread/tomcat thread will be non-blocking, but what about the thread on which CompletableFuture task is executing? ) Mono is completely non-blocking, as far as I know. Please shed some light on this and correct me if I am wrong. CompletableFuture is Async. But is it non-blocking? One which is true about

Why the signal is called twice in ReactiveCocoa?

你说的曾经没有我的故事 提交于 2019-12-03 07:44:38
I'm implementing my first code with https://github.com/ReactiveCocoa/ReactiveCocoa . Is for login a user. The line [subscriber sendNext:user]; is called twice, but I expect to be only one. And the map is not called at all (so autologin is never called) This is my implementation: -(RACSignal *) login:(NSString *)email pwd:(NSString *)pwd { DDLogInfo(@"Login user %@", email); RACSignal *login = [RACSignal createSignal:^ RACDisposable *(id<RACSubscriber> subscriber) { [PFUser logInWithUsernameInBackground:email password:pwd block:^(PFUser *user, NSError *error) { if (error) { [subscriber

Is Slick 3.0 reactive/asynchronous at the database driver level? For which databases?

左心房为你撑大大i 提交于 2019-12-03 07:33:02
问题 Slick has historically relied on JDBC drivers, which internally block waiting for socket I/O in response to queries. Every outstanding database call requires a thread to block on a socket; hence, it's not really reactive in the same sense as ReactiveMongo, postgresql-async and mysql-async, which are asynchronous all the way down. Has anything changed in this regard in Slick 3.0? Or am I confused about any of this? 回答1: It is not async down to the driver level, but that is not a problem. The