These are chat archives for akkadotnet/AkkaStreams

3rd
Jan 2018
metachro
@metachro
Jan 03 2018 00:47 UTC
@Horusiath hey, i've simplified it down to just generating a ienumerable of ints and it also gets stuck with default settings
public IEnumerable<int> GenerateInt()
{
    for (int i = 0; i < 99999; ++i)
        yield return i;
}

public void Execute()
{
    using (var s = ActorSystem.Create("system"))
    using (var m = s.Materializer())
    {
        var g = RunnableGraph.FromGraph(
            GraphDsl.Create(b =>
            {
                var src = b.Add(Source.From(GenerateInt()));
                var snk = b.Add(Sink.ForEach<int>((f) => { Console.WriteLine(f); }));

                b.From(src).To(snk);
                return ClosedShape.Instance;
            }));

        g.Run(m);
    }

    Console.ReadLine();
}
always gets to 1166 and gets stuck on my machine
Marc Piechura
@marcpiechura
Jan 03 2018 04:49 UTC
@metachron g.Run(m) runs asynchron, so you need to put the ReadLine into the using block
metachro
@metachro
Jan 03 2018 05:30 UTC
ahh i see, that's what horusiath was alluding to as well.
metachro
@metachro
Jan 03 2018 05:38 UTC
without something that blocks to keep the materializer in scope, what is the right way to "let it run to completion"? i'm a bit confused by how Run() for runnablegraph is different from .RunWith that is availble when you're using prebuilt graphs
you know what, i think i've just found my answer--and it looks like it's you who answered it for someone else in the main channel
materialization lets me get the task that i can hold on to, correct?
Marc Piechura
@marcpiechura
Jan 03 2018 07:02 UTC
Yup that’s right :)
In generell Run returns the materialized value of the graph, what that value is depends on the graph itself