示例#1
0
        public void SetupAkkaActors()
        {
            const string akkaConfig = @"
                akka {
                  loglevel = WARNING
                }
            ";

            ActorSystem            = ActorSystem.Create("hashing", ConfigurationFactory.ParseString(akkaConfig));
            Materializer           = ActorSystem.Materializer();
            ManualResetSlimForAkka = new ManualResetEventSlim();
            PipelineActorRef       = ActorSystem.ActorOf(PipelineActor.Configure(InputElements, CombineBy, ManualResetSlimForAkka), "pipeline");
        }
示例#2
0
        public static void AkkaActors()
        {
            var          stopWatch  = new Stopwatch();
            const string akkaConfig = @"
akka {
  loggers = [""Akka.Event.DefaultLogger""]
}
";

            using var system          = ActorSystem.Create("hashing", ConfigurationFactory.ParseString(akkaConfig));
            using var manualResetSlim = new ManualResetEventSlim();
            stopWatch.Start();

            var pipeline = system.ActorOf(PipelineActor.Configure(InputElements, CombineBy, manualResetSlim), "pipeline");

            pipeline.Tell(Enumerable.Range(0, InputElements).Select(i => i.ToString()));
            manualResetSlim.Wait();
            stopWatch.Stop();
            Console.Out.WriteLine($"\n\n Elapsed {stopWatch.Elapsed}... \n\n");
        }