These are chat archives for akkadotnet/AkkaStreams

24th
May 2016
Arjen Smits
@Danthar
May 24 2016 07:10 UTC
I dont understand this sample:
  val driftFlow = Flow[Double]
      .expand(i => Iterator.from(0).map(i -> _))
Marc Piechura
@marcpiechura
May 24 2016 07:15 UTC
the iterator is creating tuples with values (i,n) where i is the value produced from the upstream and n is a counter started from 0
so you get (1, 0), (1,1), (1,2) .... until upstream sends a new item, if that's the case for example 3 you then get (3, 0), (3,1), (3,2)...
Arjen Smits
@Danthar
May 24 2016 07:21 UTC
ah. so Iterator.From(0) is another infinite collection thing
Marc Piechura
@marcpiechura
May 24 2016 07:21 UTC
yep
Arjen Smits
@Danthar
May 24 2016 07:21 UTC
ok.
That was the thing i was missing.
Another thing. Its pretty annoying searching for Iterator based api docs
from scala
Arjen Smits
@Danthar
May 24 2016 07:37 UTC
that is very helpfull. thx
Marc Piechura
@marcpiechura
May 24 2016 12:46 UTC
urgh, I think we need another Operations file for SubFlow otherwise all call's are using the internal dsl api which returns IFlow and therefore we need to cast it back to a SubFlow if we want to call MergeSubStream
for example
 var subFlows =
                words.GroupBy(MaximumDistinctWords, x => x)
                    .Select(x => Tuple.Create(x, 1))
                    .Sum((l, r) => Tuple.Create(l.Item1, l.Item2 + r.Item2));
            var counts = ((SubFlow<Tuple<string, int>, NotUsed, RunnableGraph<NotUsed>>) subFlows).MergeSubstreams();
Chris Constantin
@cconstantin
May 24 2016 14:27 UTC
@Silv3rcircl3 I think that would be best, creating a new Operations file
might even make sense to create a T4 template to generate it
also, I was thinking, wouldn’t it be better to change Flow.Create to take arguments so we skip the insertion of an identity flow in the graph?
Marc Piechura
@marcpiechura
May 24 2016 14:31 UTC
I created a PR for the subFlows akkadotnet/akka.net#1974
could you maybe give an example what you mean? I don't understand where An identity flow is needed in the GraphDsl
Chris Constantin
@cconstantin
May 24 2016 14:33 UTC
doesn’t Flow.Create<>() return an identity flow?
Marc Piechura
@marcpiechura
May 24 2016 14:37 UTC
It does
Chris Constantin
@cconstantin
May 24 2016 14:40 UTC
Let me look at the source again before I say something dumb :)
Chris Constantin
@cconstantin
May 24 2016 15:05 UTC
@Silv3rcircl3 checked the source, basically what I was getting at is that we can use Flow.FromGraph or FromSinkAndSource in some examples
I thought we didn’t get around to implement those methods yet, but they are there
Chris Constantin
@cconstantin
May 24 2016 15:15 UTC
@Silv3rcircl3 a test failed on the subflow ops PR
Marc Piechura
@marcpiechura
May 24 2016 15:28 UTC
It's the racy one
Marc Piechura
@marcpiechura
May 24 2016 15:42 UTC
Ah I see, yeah they are already there, have you some examples in mind where we should use them but doesn't?
Chris Constantin
@cconstantin
May 24 2016 15:43 UTC
I made a note to look into/remove all usages of Flow.Create and Source.Create from the tests, I believe that’s where I noticed we could simplify the creation of flows