Akka.Streams.Tests.Performance.MaterializationBenchmark.GraphWithImportedFlowBuilder C# (CSharp) Метод

GraphWithImportedFlowBuilder() публичный статический Метод

public static GraphWithImportedFlowBuilder ( int numberOfFlows ) : IRunnableGraph
numberOfFlows int
Результат 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

Пример #1
0
 public void Graph_with_1000_imported_flows() => MaterializationBenchmark.GraphWithImportedFlowBuilder(1000);