public static void Main(string[] args) { Console.WriteLine("Hello Actors!"); int numThreads = 2; ActorSystem system = new ActorSystem(numThreads); int produceCount = 20; int numProcessors = 2; system.AddMailbox("/producer", () => new ProduceActor("/processor", produceCount, numProcessors), 100); Enumerable.Range(0, numProcessors).ToList().ForEach(i => { system.AddMailbox("/processor/" + i, () => new LongWorkActor("/joiner"), 2); }); system.AddMailbox("/joiner", () => new JoinActor(), 1); Debug.Assert(system.TrySendMessage(null, "/producer", "test")); Thread.Sleep(15 * 1000); Console.WriteLine("Stopping"); system.Stop(); }
public static void Main(string[] args) { Console.WriteLine("Hello Actors!"); int numThreads = 2; ActorSystem system = new ActorSystem(numThreads); int produceCount = 20; int numProcessors = 2; system.AddMailbox("/producer", () => new ProduceActor("/processor", produceCount, numProcessors), 100); Enumerable.Range(0, numProcessors).ToList().ForEach(i => { system.AddMailbox("/processor/" + i, () => new LongWorkActor("/joiner"), 2); }); system.AddMailbox("/joiner", () => new JoinActor(), 1); Debug.Assert(system.TrySendMessage(null, "/producer", "test")); Thread.Sleep(15 * 1000); Console.WriteLine("Stopping"); system.Stop(); }