Akka.Streams.Tests.Performance.MaterializationBenchmark.GraphWithImportedFlowBuilder C# (CSharp) Method

GraphWithImportedFlowBuilder() public static method

public static GraphWithImportedFlowBuilder ( int numberOfFlows ) : IRunnableGraph
numberOfFlows int
return IRunnableGraph
        public static IRunnableGraph<NotUsed> GraphWithImportedFlowBuilder(int numberOfFlows)
        {
            return RunnableGraph.FromGraph(GraphDsl.Create(Source.Single(NotUsed.Instance), (b, s) =>
            {
                var flow = Flow.Create<NotUsed>().Select(x => x);
                var outlet = s.Outlet;
                for (var i = 0; i < numberOfFlows; i++)
                {
                    var flowShape = b.Add(flow);
                    b.From(outlet).To(flowShape);
                    outlet = flowShape.Outlet;
                }
                b.From(outlet).To(Sink.Ignore<NotUsed>().MapMaterializedValue(_ => NotUsed.Instance));
                return ClosedShape.Instance;
            }));
        }

Usage Example

Exemplo n.º 1
0
 public void Graph_with_1000_imported_flows() => MaterializationBenchmark.GraphWithImportedFlowBuilder(1000);