// // Launch a process that adds the int sent in a message to its state // Then calls itself after a second to do the same again. The state value gradually // increases. // // If you stop the sample and restart you'll notice the state has been persisted // static void Main(string[] args) { // Log what's going on ProcessLog.Subscribe(Console.WriteLine); // Let Language Ext know that Redis exists RedisCluster.register(); // Connect to the Redis cluster Cluster.connect("redis", "redis-test", "localhost", "0"); // Spawn the process var pid = spawn <string>("redis-inbox-sample", Inbox, ProcessFlags.PersistInbox); Console.WriteLine("Press a key to add 100 messages to the process queue"); Console.WriteLine(" - The process queue has a Thread.Sleep(200) in it"); Console.WriteLine(" - So it takes 20 seconds to get through all of the messages"); Console.WriteLine(" - If you quit the sample and restart, you should see the "); Console.WriteLine(" - inbox has persisted."); Console.WriteLine(""); Console.WriteLine("Press a key"); Console.ReadKey(); var rnd = new Random(); for (var i = 0; i < 100; i++) { tell(pid, "Message sent: " + DateTime.Now + " " + DateTime.Now.Ticks + " " + rnd.Next()); } Console.ReadKey(); }
static void Main(string[] args) { // Remove this to get on-screen logging ProcessLog.Subscribe(Console.WriteLine); var ping = ProcessId.None; var pong = ProcessId.None; // Start a process which simply writes the messages it receives to std-out var logger = spawn <string>("logger", Console.WriteLine); // Ping process ping = spawn <string>("ping", msg => { tell(logger, msg); tell(pong, "ping", TimeSpan.FromMilliseconds(100)); }); // Pong process pong = spawn <string>("pong", msg => { tell(logger, msg); tell(ping, "pong", TimeSpan.FromMilliseconds(100)); }); // Trigger tell(pong, "start"); Console.ReadKey(); }
static void Main(string[] args) { Tests.MemoTest3(); Tests.LstRevLastIndexTest(); Console.ReadKey(); return; //Tests.QueueCollectionFunctions(); //Tests.StackCollectionFunctions(); //Tests.WrappedListOfOptionsTest1(); //Tests.WrappedListOfOptionsTest2(); //Tests.Lists(); ProcessLog.Subscribe(Console.WriteLine); Tests.KillChildTest(); Tests.ProcessStartupError(); Tests.LocalRegisterTest(); Tests.AskReply(); Tests.MassiveSpawnAndKillHierarchy(); Tests.AskReplyError(); Tests.RegisterTest(); Tests.ProcessStartupError(); Tests.RegisteredAskReply(); Tests.ClassBasedProcess(); Tests.AsyncOption(); Tests.MapOptionTest(); Tests.MassAddRemoveTest(); Tests.SpawnProcess(); Tests.SpawnProcess(); Tests.SpawnProcess(); Tests.PubSubTest(); Tests.SpawnErrorSurviveProcess(); Tests.SpawnErrorSurviveProcess(); Tests.SpawnErrorSurviveProcess(); Tests.SpawnAndKillHierarchy(); Tests.SpawnAndKillHierarchy(); Tests.SpawnAndKillHierarchy(); Tests.SpawnAndKillProcess(); Tests.SpawnAndKillProcess(); Tests.SpawnAndKillProcess(); Tests.MassiveSpawnAndKillHierarchy(); Tests.MassiveSpawnAndKillHierarchy2(); Tests.ReaderAskTest(); Tests.LiftTest(); Tests.BindingTest(); Tests.WrappedOptionOptionLinqTest(); Tests.WrappedListLinqTest(); Tests.WrappedListTest(); Tests.LinqTest(); Tests.ExTest4(); Tests.MemoTest(); Tests.UnsafeOptionTest(); }