In a recent thread on the matrix, we thought about the question, how to split data transported over a reactive flow into multiple events, depending on data size.
several solutions where proposed. splitting the data according to a given size can be done using the GroupBy (Length) node from the Spread category, in combination with an Add (Spread) node, which appends the remainder of the split to the Spread. The resulting is a Spread of Spreads, where each element will be transformed to an individual Observable event. Several equally working strategies were supposed:
the simplest solution (in node count) proposed by @woei appears to be a combination of Select (Many) and a ToObservable node (from the System.Reactive.Observable category, which has to be manually referenced):
SelectMany + toObservable<IEnumerable>
where the to observable is directly imported instead of the forwarded node. sure, there is a reason why it’s not exposed directly, but i don’t know/remember why. was something about the observable source switching while patching if i remember correctly
a similar solution using the available ToObservable (Sequence) node from CoreLib does not work in combination with Select (many):
Building an Observable Sequence using a standard ForEach with Start [Reactive.Observable] inside and Merge [Reactive.Observable] works as well.
Using Channels it is possible to get a similar result: