reactive-programming

Correlate interdependent Event Streams with RX.Net

冷暖自知 提交于 2020-01-06 13:58:53
问题 I have a class that has, among others, the three following events: DataSourceLoaded DataSourceUnloaded DataSourceFieldChanged Right now I am using RX.Net in combination with its .Throttle() 'ing functionality to slow down handling of burst / frequent incoming events as I only need to know IF something changed recently, not every single occurrence is relevant to me. The part that I have a bit of problems with is that the underlying datasource may be added/removed at any time and the handler of

Correlate interdependent Event Streams with RX.Net

删除回忆录丶 提交于 2020-01-06 13:58:32
问题 I have a class that has, among others, the three following events: DataSourceLoaded DataSourceUnloaded DataSourceFieldChanged Right now I am using RX.Net in combination with its .Throttle() 'ing functionality to slow down handling of burst / frequent incoming events as I only need to know IF something changed recently, not every single occurrence is relevant to me. The part that I have a bit of problems with is that the underlying datasource may be added/removed at any time and the handler of

Spring Boot Data Rest don't support reactive?

假如想象 提交于 2020-01-06 08:04:08
问题 So, that error got in log ERROR 15340 --- [nio-8086-exec-9] o.s.d.r.w.RepositoryRestExceptionHandler : reactor.core.publisher.FluxOnAssembly cannot be cast to java.lang.Iterable Create a project by spring initialize: Reactive web, data-rest, data-rest-hal-browser, reactive-mongodb. When i try using data-rest router's i got error. In my opinion that happen, cuz data-rest don't support reactive. Can someone told how fix that? 回答1: No yet, see the ticket [DATAREST-933] 来源: https://stackoverflow

Spring Boot Data Rest don't support reactive?

瘦欲@ 提交于 2020-01-06 08:03:52
问题 So, that error got in log ERROR 15340 --- [nio-8086-exec-9] o.s.d.r.w.RepositoryRestExceptionHandler : reactor.core.publisher.FluxOnAssembly cannot be cast to java.lang.Iterable Create a project by spring initialize: Reactive web, data-rest, data-rest-hal-browser, reactive-mongodb. When i try using data-rest router's i got error. In my opinion that happen, cuz data-rest don't support reactive. Can someone told how fix that? 回答1: No yet, see the ticket [DATAREST-933] 来源: https://stackoverflow

Rx.Net multiple Mergerd Observables & Throttle() not working as expected

折月煮酒 提交于 2020-01-06 07:04:54
问题 I have multiple source Obserables that emit Unit.Default instances merged into one stream and the later being .Throttle()'ed to yield a result after 300ms of 'silence' var columnVisibilityChangedObservable = Observable.FromEventPattern<ColumnVisibilityChangedEventArgs>( handler => this.ColumnVisibilityChanged += handler, handler => this.ColumnVisibilityChanged -= handler) .Select(_ => Unit.Default); var dataBindingCompleteObservable = Observable.FromEventPattern

Passing parameter to Observable.create

蹲街弑〆低调 提交于 2020-01-06 04:22:06
问题 I am using RXJava on Android for asynchronously access the database. I want to save an object in my database. In this way, I created a method which take a final parameter (the object I want to save) and returns an Observable. At this point I don't care to emit anything so I will call subscriber.onComplete() at the end. Here is my code: public Observable saveEventLog(@NonNull final EventLog eventLog) { return Observable.create(new Observable.OnSubscribe<Object>() { @Override public void call

Catch circular dependency between observables

拈花ヽ惹草 提交于 2020-01-06 04:12:07
问题 I have a user-programming scenario where user can end up creating two observables that depend on each other. RxJS does not allow circular dependencies, as far as I can see, the memory or stack reaches its limits and the onError callback is triggered with the value true . How to detect the circular dependency explicitly and throw a more descriptive error message? This codes illustrates how to create a circular dependency in RxJS: var obsA, obsB; obsA = Rx.Observable .returnValue(42)

Reactor Mono - execute parallel tasks

て烟熏妆下的殇ゞ 提交于 2020-01-05 10:09:22
问题 I am new to Reactor framework and trying to utilize it in one of our existing implementations. LocationProfileService and InventoryService both return a Mono and are to executed in parallel and have no dependency on each other (from the MainService). Within LocationProfileService - there are 4 queries issued and the last 2 queries have a dependency on the first query. What is a better way to write this? I see the calls getting executed sequentially, while some of them should be executed in

Send data from InputStream over Akka/Spring stream

China☆狼群 提交于 2020-01-05 09:21:32
问题 Here is my previous question: Send big file over reactive stream I have managed to send file over Akka stream using FileIO.fromPath(Paths.get(file.toURI())) and it works fine. However, I would like to compress and encrypt file before sending it. I have created method, that opens FileInputStream, routes it through compression stream and then through encryption stream and now I would like to direct it into socket using Akka stream. File -> FileInputStream -> CompressedInputStream ->

Reduce returns empty array, however scan does not

淺唱寂寞╮ 提交于 2020-01-05 05:51:06
问题 Code: const Rx = require('rxjs') const data = [ { name: 'Zachary', age: 21 }, { name: 'John', age: 20 }, { name: 'Louise', age: 14 }, { name: 'Borg', age: 15 } ] const dataSubj$ = new Rx.Subject() function getDataStream() { return dataSubj$.asObservable().startWith(data); } getDataStream() .mergeMap(Rx.Observable.from) .scan((arr, person) => { arr.push(person) return arr }, []) .subscribe(val => console.log('val: ', val)); Using .reduce(...) instead of .scan(...) returns an empty array and