system.reactive

Correct way to merge observable sequences for events fired from multiple instances

倖福魔咒の 提交于 2019-12-10 10:31:47
问题 Say I have a factory method that churns out instances of type T, and I want an Rx observable sequence for events fired from all my instances originating out of the factory method. Is using Merge() as I have done below the correct and optimal way to achieve this? The other way I did this was to use a static event and make the observable sequence out of that, however I generally don't like using static events and am curious what any Rx experts think would be optimal in this situation? public T

How to serialize Observables to the cloud and back

╄→尐↘猪︶ㄣ 提交于 2019-12-10 10:04:16
问题 I need to split processing sequence (like in this question How to organize sequence of data processors with .net RX) into several computation units in Azure environment. The idea is to serialize Observable sequence to Azure Queues(or Service Bus) and to deserialize it back. If producer or consumer is failed other party should be able to continue producing/consuming. Could anyone suggest an elegant way to do so and what to use (Azure Queues or Service Bus)? Has anyone used TCP Observable

Is there an equivalent of the Task.ContinueWith operator in Rx?

纵然是瞬间 提交于 2019-12-10 09:32:00
问题 Is there an equivalent of the Task.ContinueWith operator in Rx? I'm using Rx with Silverlight, I am making two webservice calls with the FromAsyncPattern method, and I'd like to do them synchronously . var o1 = Observable.FromAsyncPattern<int, string>(client.BeginGetData, client.EndGetData); var o2 = Observable.FromAsyncPattern<int, string>(client.BeginGetData, client.EndGetData); Is there an operator (like Zip) that will only start / subscribe to o2 only after o1 returns Completed? I handle

Confusion over behavior of Publish().Refcount()

半腔热情 提交于 2019-12-10 09:24:24
问题 I've got a simple program here that displays the number of letters in various words. It works as expected. static void Main(string[] args) { var word = new Subject<string>(); var wordPub = word.Publish().RefCount(); var length = word.Select(i => i.Length); var report = wordPub .GroupJoin(length, s => wordPub, s => Observable.Empty<int>(), (w, a) => new { Word = w, Lengths = a }) .SelectMany(i => i.Lengths.Select(j => new { Word = i.Word, Length = j })); report.Subscribe(i => Console.WriteLine

Sorting buffered Observables

只愿长相守 提交于 2019-12-10 07:00:05
问题 I've got a stream of tokens that are produced very quickly and a processer that is relatively slow. The tokens are of three sub-types and I would prefer them to processed by their priority. So, I would like the tokens to be buffered after they've been produced and are waiting to be processed and have that buffer sorted by priority. Here're my classes: public enum Priority { High = 3, Medium = 2, Low = 1 } public class Base : IComparable<Base> { public int Id { get; set; } public int CompareTo

How to use Reactive Extensions to parse a stream of characters from a serial port?

馋奶兔 提交于 2019-12-10 03:41:56
问题 I need to parse a stream of serial data coming from a test instrument, and this seems to be an excellent application for Reactive Extensions. The protocol is very simple...each "packet" is a single letter followed by numeric digits. The number of numeric digits is fixed for each packet type, but can vary between packet types. e.g. ...A1234B123456C12... I am trying to break this up into an Observable of Strings, e.g. "A1234" "B123456" "C12" ... Thought this would be simple, but don't see the

Rx - Divide stream into segments (lists) by condition

送分小仙女□ 提交于 2019-12-10 03:21:19
问题 I have an RX producer that creates a stream of strings like so (simplified version of the real stream): A1 A2 A3 B1 B2 C1 C2 C3 C4 C5 C6.... The stream is endless, but ordered. So after the strings that start with A run out, B starts. When B runs out, C starts... when Z run out, we move to AA1 etc. There's an unknown number of A 's, B 's etc, but it's typically 10-30 instances per letter. I'm looking for a way to divide this stream into blocks of all A's: A1 A2 A3 , all B's: B1 B2 , all C's:

Where to draw the line with reactive programming [closed]

瘦欲@ 提交于 2019-12-10 03:06:05
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 3 years ago . I have been using RxJava in my project for about a year now. With time, I grew to love it very much - now I'm thinking maybe too much... Most methods I write now have some form of Rx in it, which is great! (until it's not). I now notice that some methods require a lot of work

Will Reactive Extensions (Rx) supersede the Task Parallel Library?

感情迁移 提交于 2019-12-10 02:56:12
问题 After following through the samples of Rx.NET, I'm gob smacked at how brilliant the concept and implementation of Reactive Extensions are. It appears to offer developers a more maintainable pattern for achieving the same sort of multi-threaded parallel coding that .NET 4.0's task parallel library offers. Will Rx.NET supersede TPL? Should it? 回答1: In short, no. The Task Parallel Library (TPL) provides provides distribution of work ( concurrency ), as well as the concurrent optimisation of

ValveSubject: a queuing subject for Rx with built-in buffering, open/close operations

﹥>﹥吖頭↗ 提交于 2019-12-09 23:43:26
问题 I have often run into situations where I need some sort of valve construct to control the flow of a reactive pipeline. Typically, in a network-based application I have had the requirement to open/close a request stream according to the connection state. This valve subject should support opening/closing the stream, and output delivery in FIFO order. Input values should be buffered when the valve is closed. A ConcurrentQueue or BlockingCollection are typically used in such scenarios, but that