static void Main(string[] args) { // Remove this to get on-screen logging ProcessSystemLog.Subscribe(Console.WriteLine); // Let Language Ext know that Redis exists RedisCluster.register(); // Connect to the Redis cluster ProcessConfig.initialiseFileSystem("session-test-1"); 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", x => Console.WriteLine(x)); sessionStart("xyz", 20 * seconds, "live"); // Ping process ping = spawn <string>("ping", msg => { tell(logger, msg); var txt = hasSession() ? sessionId().ToString() : "expired"; var val = sessionGetData <int>("test"); sessionSetData("test", val.FirstOrDefault() + 1); tell(pong, $"ping-{txt}-{val.FirstOrDefault()}", TimeSpan.FromMilliseconds(1000)); }); // Pong process pong = spawn <string>("pong", msg => { tell(logger, msg); var txt = hasSession() ? sessionId().ToString() : "expired"; var val = sessionGetData <int>("test"); sessionSetData("test", val.FirstOrDefault() + 1); tell(ping, $"pong-{txt}-{val.FirstOrDefault()}", TimeSpan.FromMilliseconds(1000)); }); // Trigger tell(pong, "start"); Console.ReadKey(); }
public static void Main(string[] args) { // Remove this to get on-screen logging ProcessSystemLog.Subscribe(Console.WriteLine); RedisCluster.register(); ProcessConfig.initialiseFileSystem("ping-pong-1"); var ping = ProcessId.None; var pong = ProcessId.None; Process.PreShutdown.Subscribe(_ => { kill(ping); kill(pong); }); // Start a process which simply writes the messages it receives to std-out var logger = spawn <string>("logger", x => Console.WriteLine(x)); // Ping process ping = spawn <string>("ping", msg => { tell(logger, msg); var res = readList <int>("arr"); var name = read("name", ""); var ind = read("count", 0); write("count", ind + 1); tell(pong, $"ping {name}-{ind}", TimeSpan.FromMilliseconds(100)); }); // Pong process pong = spawn <string>("pong", msg => { tell(logger, msg); var map = readMap <string>("map"); var name = read("name", ""); var ind = read("count", 0); write("count", ind + 1); tell(ping, $"pong {name}-{ind}", TimeSpan.FromMilliseconds(100)); }); // Trigger tell(ping, "start"); Console.ReadKey(); Process.shutdownAll(); }
static void Main(string[] args) { ProcessConfig.initialiseFileSystem(); //Test1(); //Test2(); //Test3(); ConfigTest1(); ConfigTest2(); ConfigTest3(); }
static void Main(string[] args) { ProcessConfig.initialiseFileSystem(); try { Test1(); Test2(); } catch (Exception e) { Console.WriteLine(e.Message); } }
public static void StopStartImpl() { shutdownAll(); ProcessConfig.initialiseFileSystem(); ProcessId pid = spawn <string, string>("start-stop", () => "", (_, msg) => msg); tell(pid, "1"); kill(pid); var kids = children(User()); var len = kids.Length; Debug.Assert(len == 0); }