reactive-programming

How to handle open ended pagination using reactive streams?

丶灬走出姿态 提交于 2019-12-11 07:36:46
问题 I am using RxJS for all async request handling in my redux application. One thing in particular I am using it for is enumerating all the results from a paginated AWS API. Those APIs generally do not allow random page jumping, one must call the API with a special token ( nextToken ) from the previous call and follow the sequence. The list is complete when there is no nextToken sent with the response. What I would like to do is have a stream of the partial page results that I can at the end

Adapting RxJava 1.1.5 to Reactor Core 3.1.0.M3

给你一囗甜甜゛ 提交于 2019-12-11 06:39:19
问题 I am trying to use a library that uses RxJava 1.1.5 with Spring WebFlux (i.e. Reactor Core 3.1.0.M3) but I am having trouble adapting Observable to Flux . I thought this would be relatively straightforward, but my adapter isn't working: import reactor.core.publisher.Flux; import rx.Observable; import rx.Subscriber; import rx.Subscription; public static <T> Flux<T> toFlux(Observable<T> observable) { return Flux.create(emitter -> { final Subscription subscription = observable.subscribe(new

Dependencies in functions. Two functions working individually but when combined in code are showing error in Shiny

守給你的承諾、 提交于 2019-12-11 06:19:38
问题 I have 2 separate codes which work individually (Code A and Code B). When I club these codes to create single app, it shows error when both inputs are updated. Not sure where the error is? Code A library(shiny) dfaa <- data.frame(A = c( 1L, 4L, 0L, 1L), B = c("3","*","*","2"), C = c("4","5","2","*"), D = c("*","9","*","4"),stringsAsFactors = F) dfbb <- data.frame(variable = c("A","B","C","D"), Value = c( 2L, 1L, 9L, 0L),stringsAsFactors = F) dfbb["Drop_Variable"] <- "No" ui <- fluidPage

Using project reactor mergeWith() operator in order to achieve “if/elseif/else” branching logic

删除回忆录丶 提交于 2019-12-11 06:05:01
问题 I am trying to use project reactor mergeWith operator in order to achieve a if/elseif/else branching logic as described here: RxJS, where is the If-Else Operator. The provided samples are written in RxJS but the underlying idea remains the same. Basically the idea is to use the filter operator on 3 monos/publishers (therefore with 3 different predicates) and merge the 3 monos as follows (here they are RxJS Observables of course): const somethings$ = source$ .filter(isSomething) .do(something)

R shinyapp - How to open and plot from csv. Getting Error: attempt to select less than one element in get1index

╄→гoц情女王★ 提交于 2019-12-11 05:45:49
问题 I'm new to shinyapps and trying to build a simple app that can open a .csv with four columns. After opening, the user is can select three columns used to plot a) points and b) ranges above and below the respective points - see first image below. However, at this point I don't know how to reference my point data in the plot. I get Error: attempt to select less than one element in get1index. - see second image below. nI have included a 5 line .csv file at the bottom of the text. Desired output:

Retrieve XDocument only when modified using Rx + WebRequest + XDocument.Load

狂风中的少年 提交于 2019-12-11 05:34:15
问题 I have the following two observables System.Net.WebRequest req = System.Net.HttpWebRequest.Create("http://test.com/data.xml"); req.Method = "HEAD"; var ob = Observable.FromAsyncPattern(req.BeginGetResponse, req.EndGetResponse); ob().Select(x => x).Select(x => x.Headers["Last-Modified"]).DistinctUntilChanged(x => x); Observable .Interval(TimeSpan.FromSeconds(1.0)) .Select(_ => XDocument.Load("http://test.com/data.xml")); I would like it that the XDocument observable is only executed when "last

Reactor Flux replay(int history) method not working as expected

Deadly 提交于 2019-12-11 05:11:30
问题 I'm trying to make an example of a Flux with Project Reactor that has the following characteristics: A single hot observable, which emits one item per second. Two subscribers, each of them using a separate thread of the publisher. A limited history when calling replay() , so some items will be missed in case one of the subscribers is too slow. Then I coded this sample: import java.time.Duration; import reactor.core.publisher.ConnectableFlux; import reactor.core.publisher.Flux; import reactor

Rx grouped throttling

拥有回忆 提交于 2019-12-11 04:36:10
问题 I have an IObservable<T> where T looks like public class Notification { public int Id { get; set; } public int Version { get; set; } } Notifications are produced at variable time intervals and for different notifications, where the version number get incremented with each updated per notification id. What would be a proper approach to throttle the observable for a specific period of time and then to receive distinct notifications with the latest Version field? So far I came up with this for

Dynamically rendered UI: how to delete old reactive variables on second run

被刻印的时光 ゝ 提交于 2019-12-11 04:35:42
问题 Hello heroes of Stack overflow, SHORT SUMMARY: App works great, until you change the entered number in the input field. UI re-renders great, but server side fails on stuff still in the memory it seems. Detailed explanation below: I have a nicely working dynamic app, but I'm still dealing with a few bugs and one core problem. The problem must be somewhere in the reactivity but I'm having a lot of difficulty to figure out what it is that Im doing wrong. I've tried dozens of things already, and

Fire and forget with reactor

别说谁变了你拦得住时间么 提交于 2019-12-11 04:25:14
问题 I have a method like below in my Spring boot app. public Flux<Data> search(SearchRequest request) { Flux<Data> result = searchService.search(request);//this returns Flux<Data> Mono<List<Data>> listOfData = result.collectList(); // doThisAsync() // here I want to pass this list and run some processing on it // the processing should happen async and the search method should return immediately. return result; } //this method uses the complete List<Data> returned by above method public void