コード例 #1
0
        static void Main(string[] args)
        {
            // Trinity doesn't load the config file correctly if we don't tell it to.
            TrinityConfig.LoadConfig();
            TrinityConfig.CurrentRunningMode = RunningMode.Client;


            while (true)
            {
                string command = Console.ReadLine();
                long   id      = long.Parse(command.Split(' ')[1]);

                if (command.StartsWith("root"))
                {
                    StartSSSP(id);
                }
                else if (command.StartsWith("distance"))
                {
                    var cell = Global.CloudStorage.LoadSSSPCell(id);

                    Console.WriteLine("Distance: {0}", cell.distance);

                    Console.Write("Neighbors: ");
                    List <long> neighbors = cell.neighbors;
                    for (int i = 0; i < neighbors.Count; i++)
                    {
                        Console.Write("{0} ", neighbors[i]);
                    }
                    Console.WriteLine();
                }
            }
        }
コード例 #2
0
        static void Main(string[] args)
        {
            // Trinity doesn't load the config file correctly if we don't tell it to
            TrinityConfig.LoadConfig("trinity" + args[0] + ".xml");

            HITSServerImpl server = new HITSServerImpl();

            server.Start();


            if (loadData && Global.MyPartitionId == 0)
            {
                Console.WriteLine("Starting to load data");

                using (var reader = new StreamReader("Model_Journals_Fields.txt")) {
                    string         line;
                    string[]       fields;
                    long           currentNode = -1;
                    HashSet <long> references  = new HashSet <long>();

                    while ((line = reader.ReadLine()) != null)
                    {
                        try {
                            fields = line.Split();
                            long from = long.Parse(fields[0]);
                            long to   = long.Parse(fields[2]);


                            if (from == currentNode || currentNode == -1)
                            {
                                references.Add(to);
                                currentNode = from;
                            }
                            else
                            {
                                Global.CloudStorage.SaveJournal(currentNode, References: references.ToList(), HubScore: 0, OldHubScore: 0, AuthorityScore: 0, OldAuthorityScore: 0);
                                references.Clear();
                                references.Add(to);
                                currentNode = from;
                            }
                        } catch (Exception e) {
                            Console.WriteLine(e.ToString());
                        }
                    }
                    Global.CloudStorage.SaveStorage();
                    Console.WriteLine("Finished loading data");
                }
            }
            else if (Global.MyPartitionId == 0)
            {
                Global.CloudStorage.LoadStorage();
                Console.WriteLine("Finished loading data");
            }


            Console.ReadLine();

            server.Stop();
        }
コード例 #3
0
        static void Main(string[] args)
        {
            // Trinity doesn't load the config file correctly if we don't tell it to
            TrinityConfig.LoadConfig();
            TrinityConfig.CurrentRunningMode = RunningMode.Server;

            BFSServerImpl server = new BFSServerImpl();

            server.Start();

            Console.WriteLine("Starting to load data");

            using (var reader = new StreamReader("p2p-Gnutella31.txt")) {
                //using (var reader = new StreamReader("com-youtube.ungraph.txt")) {
                //using (var reader = new StreamReader("com-orkut.ungraph.txt")) {
                string      line;
                string[]    fields;
                long        currentNode = 0;
                List <long> neighbors   = new List <long>();

                while ((line = reader.ReadLine()) != null)
                {
                    try {
                        fields = line.Split(null);
                        long from = long.Parse(fields[0]);
                        long to   = long.Parse(fields[1]);



                        if (from == currentNode)
                        {
                            neighbors.Add(to);
                        }
                        else
                        {
                            Global.CloudStorage.SaveBFSCell(currentNode, level: int.MaxValue, parent: -1, neighbors: neighbors);
                            neighbors.Clear();
                            neighbors.Add(to);
                            currentNode = from;
                        }
                    } catch (Exception e) {
                        Console.WriteLine(e.ToString());
                        //break;
                    }
                }
            }



            Console.WriteLine("Finished loading data");
            Console.WriteLine("Press Enter to close");

            Console.ReadLine();
        }
コード例 #4
0
        static void Main(string[] args)
        {
            // Trinity doesn't load the config file correctly if we don't tell it to
            TrinityConfig.LoadConfig();
            TrinityConfig.CurrentRunningMode = RunningMode.Server;

            DistributedHashtableServer server = new DistributedHashtableServer();

            server.Start();

            Console.ReadKey();
        }
コード例 #5
0
        static void Main(string[] args)
        {
            // Trinity doesn't load the config file correctly if we don't tell it to
            TrinityConfig.LoadConfig();
            TrinityConfig.CurrentRunningMode = RunningMode.Server;
            // Create our PingServer implementation an start it.
            SimplePingServer server = new SimplePingServer();

            server.Start();

            Console.ReadKey();
        }
コード例 #6
0
        static void Main(string[] args)
        {
            // Trinity doesn't load the config file correctly if we don't tell it to
            TrinityConfig.LoadConfig();
            TrinityConfig.CurrentRunningMode = RunningMode.Server;
            SimpleBenchmarkServer server = new SimpleBenchmarkServer();

            server.Start();
            while (true)
            {
                Thread.Sleep(200);
            }
        }
コード例 #7
0
        static void Main(string[] args)
        {
            // Trinity doesn't load the config file correctly if we don't tell it to.
            TrinityConfig.LoadConfig();
            //TrinityConfig.CurrentRunningMode = RunningMode.Proxy;
            //TrinityConfig.CurrentRunningMode = RunningMode.Client;

            CoordinatorImpl coordinator = new CoordinatorImpl();

            coordinator.Start();

            Coordinator.MessagePassingExtension.RunHITS(Global.CloudStorage.ProxyList[0]);

            //coordinator.RunHITSHandler();

            /*
             * ulong cellCount = GetCellCount();
             * Console.WriteLine("Journal Count: {0}", cellCount);
             *
             * double initialAuthScore = 1;
             * double initialHubScore = 1;
             *
             * SetInitialScores(initialHubScore, initialAuthScore);
             *
             * for (int  i = 0; i < 5; i++) {
             * Console.WriteLine("Starting Update Round: {0}", i);
             * AuthUpdate();
             * HubUpdate();
             * }
             *
             * Console.WriteLine("Top Authorities:");
             * Console.WriteLine("_________________");
             * List<long> topAuthorities = GetTopAuthorities();
             * foreach(long authorityId in topAuthorities) {
             * Journal authority = Global.CloudStorage.LoadJournal(authorityId);
             * Console.WriteLine("ID: {0}, Score: {1}", authority.CellId, authority.AuthorityScore);
             * }
             *
             *
             * Console.WriteLine("Top Hubs:");
             * Console.WriteLine("_________________");
             * List<long> topHubs = GetTopHubs();
             * foreach(long hubId in topHubs) {
             * Journal hub = Global.CloudStorage.LoadJournal(hubId);
             * Console.WriteLine("ID: {0}, Score: {1}", hub.CellId, hub.HubScore);
             * }
             */
        }
コード例 #8
0
        static void Main(string[] args)
        {
            // Trinity doesn't load the config file correctly if we don't tell it to.
            TrinityConfig.LoadConfig();
            TrinityConfig.CurrentRunningMode = RunningMode.Client;

            using (var request = new PingMessageWriter("Ping!1")) {
                Global.CloudStorage.SynPingToPingServer(0, request);
            }

            using (var request = new PingMessageWriter("Ping!2")) {
                Global.CloudStorage.AsynPingToPingServer(0, request);
            }

            using (var request = new PingMessageWriter("Ping!3")) {
                using (var response = Global.CloudStorage.SynEchoPingToPingServer(0, request)) {
                    Console.WriteLine("Server Response: {0}", response.Message);
                }
            }
        }
コード例 #9
0
ファイル: Client.cs プロジェクト: InKnowWorks/GraphEngine
        public Client(StatelessServiceContext context)
            : base(context)
        {
            TrinityConfig.LoadConfig();

            TrinityConfig.CurrentRunningMode = RunningMode.Client;
            TrinityConfig.LogEchoOnConsole   = false;
            TrinityConfig.LoggingLevel       = LogLevel.Debug;

            TrinityConfig.SaveConfig();

            Log.LogsWritten += Log_LogsWritten;

            TrinityTripleModuleClient = new TrinityClient("fabric:/GraphEngine.ServiceFabric.TripleStoreApplication/Stateful.TripleStore.GraphDataService");

            TrinityTripleModuleClient.UnhandledException += TrinityTripleModuleClient_UnhandledException1;
            TrinityTripleModuleClient.Started            += TrinityTripleModuleClientStarted;

            TrinityTripleModuleClient.Start();
        }
コード例 #10
0
        static void Main(string[] args)
        {
            // Trinity doesn't load the config file correctly if we don't tell it to.
            TrinityConfig.LoadConfig();
            TrinityConfig.CurrentRunningMode = RunningMode.Client;

            while (true)
            {
                Console.WriteLine("Input a command 'set key value' 'get key'");
                string   input  = Console.ReadLine();
                string[] fields = input.Split(" ");

                int partitionId = GetPartitionIdByKey(fields[0]);

                if (fields[0] == "get")
                {
                    using (var request = new GetMessageWriter(fields[1])) {
                        using (var response = Global.CloudStorage.GetToDHTServer(partitionId, request)) {
                            if (response.IsFound)
                            {
                                Console.WriteLine("Key:  {0} ; Value: {1}", request.Key, response.Value);
                            }
                            else
                            {
                                Console.WriteLine("Key: {0} wasn't found", request.Key);
                            }
                        }
                    }
                }
                else if (fields[0] == "set")
                {
                    using (var request = new SetMessageWriter(fields[1], fields[2])) {
                        Global.CloudStorage.SetToDHTServer(partitionId, request);
                    }
                }
            }
        }
コード例 #11
0
 static void Main(string[] args)
 {
     // Trinity doesn't load the config file correctly if we don't tell it to.
     TrinityConfig.LoadConfig();
     TrinityConfig.CurrentRunningMode = RunningMode.Client;
 }
コード例 #12
0
 public void load_config_no_exception_2()
 {
     TrinityConfig.LoadConfig("test2.xml");
 }
コード例 #13
0
 public void load_config_no_exception()
 {
     TrinityConfig.LoadConfig();
 }
コード例 #14
0
        static void Main(string[] args)
        {
            // Trinity doesn't load the config file correctly if we don't tell it to.
            TrinityConfig.LoadConfig();
            TrinityConfig.CurrentRunningMode = RunningMode.Client;

            Program program = new Program();

            program.readCommandLineArguments(args);
            program.setConfiguration();
            if (args.Length > 0)
            {
                if (args[0] == "run_all")
                {
                    using (var request = new ConfigurationMessageWriter("Start/Loader"))
                    {
                        Global.CloudStorage.SynPingToBenchmarkServer(0, request);
                    }
                }
                if (args[0] == "run")
                {
                    program.Run();
                }
                if (args[0] == "verify")
                {
                    program.verifySetup();
                }
                if (args[0] == "load")
                {
                    program.LoadGraph();
                }
                if (args[0] == "delete")
                {
                    program.Delete();
                }
            }
            else
            {
                Console.WriteLine("#######################################################################");
                Console.WriteLine("Options: (to run with configuration add run [dotnet run run [OPTIONS]])");
                Console.WriteLine("--graph-name");
                Console.WriteLine("--input-vertex-path");
                Console.WriteLine("--input-edge-path");
                Console.WriteLine("--loutput-path");
                Console.WriteLine("--directed");
                Console.WriteLine("--weighted");
                Console.WriteLine("--ejob-id");
                Console.WriteLine("--elog-path");
                Console.WriteLine("--algorithm");
                Console.WriteLine("--source-vertex");
                Console.WriteLine("--max-iterations");
                Console.WriteLine("--damping-factor");
                Console.WriteLine("--input-path");
                Console.WriteLine("--eoutput-path");
                Console.WriteLine("--home-dir");
                Console.WriteLine("--num-machines");
                Console.WriteLine("--num-threads");
                Console.WriteLine("--tjob-id");
                Console.WriteLine("--tlog-path");
            }
        }
コード例 #15
0
        private static async Task Main(string[] args)
        {
            TrinityConfig.LoadConfig(@"D:\Trinity TripleStore Server Deployment\trinity.xml");

            //graphEngineCluster = new AvailabilityGroup()
            //{
            //    Id = "rub-truespark-ge-cluster",
            //    Instances = new List<ServerInfo>()
            //    {
            //        new ServerInfo("GenNexusPrime.inknowworks.dev.net", 9888, string.Empty, LogLevel.Verbose),
            //        new ServerInfo("metagengraph-a.inknowworks.dev.net", 9888, string.Empty, LogLevel.Verbose),
            //        new ServerInfo("metagengraph-b.inknowworks.dev.net", 9888, string.Empty, LogLevel.Verbose)
            //        //new ServerInfo("truesparksf03.inknowworks.dev.net", 7808, string.Empty, LogLevel.Verbose),
            //        //new ServerInfo("truesparksf04.inknowworks.dev.net", 7808, string.Empty, LogLevel.Verbose),
            //        //new ServerInfo("truesparksf05.inknowworks.dev.net", 7808, string.Empty, LogLevel.Verbose)
            //    }
            //};

            TrinityConfig.LoggingLevel = LogLevel.Debug;
            //TrinityConfig.Servers.Add(graphEngineCluster);
            //TrinityConfig.CurrentRunningMode = RunningMode.Server;
            //TrinityConfig.AddServer(TripleStoreServerInfo);
            //TrinityConfig.LogEchoOnConsole = true;
            //TrinityConfig.StorageRoot = TripleStoreStorageRoot;

            //Log.LogsWritten += Log_LogsWritten;

            TripleStoreServer = new TrinityServer();

            var registeredModuleTypes = TripleStoreServer.GetRegisteredCommunicationModuleTypes();

            var moduleTypes = registeredModuleTypes as Type[] ?? registeredModuleTypes.ToArray();

            if (!moduleTypes.Contains(typeof(TrinityClientModule)))
            {
                TripleStoreServer.RegisterCommunicationModule <TrinityClientModule>();
            }

            if (!moduleTypes.Contains(typeof(TripleModule)))
            {
                TripleStoreServer.RegisterCommunicationModule <TripleModule>();
            }

            //TripleStoreServer.Started += TripleStoreServer_Started;
            //TripleStoreServer.RegisterCommunicationModule<TripleStoreDemoServerModule>();

            TripleStoreServer.Start();

            //Global.CloudStorage.ResetStorage();
            //Global.LocalStorage.ResetStorage();

            //Global.LocalStorage.LoadStorage();

            GraphEngineTripleClientAPI = TripleStoreServer.GetCommunicationModule <TrinityClientModule>();

            // We inject an instance of the TripleModule class object so that we hook-up to our custom sever-side code

            GraphEngineTripleServerAPI = TripleStoreServer.GetCommunicationModule <TripleModule>();

            if (GraphEngineTripleServerAPI != null)
            {
                Log.WriteLine("Setup Reactive Event Stream Processing!");

                GraphEngineTripleServerAPI.TriplePostedToServerReceivedAction
                .ObserveOn(GraphEngineTripleServerAPI.ObserverOnNewThreadScheduler)
                .Do(onNext: subscriberSource =>
                {
                    var msg = "TriplePostedToServerReceivedAction-1";
                    Log.WriteLine("{0} Subscription happened on this Thread: {1}", msg, Thread.CurrentThread.ManagedThreadId);
                })
                .SubscribeOn(GraphEngineTripleServerAPI.SubscribeOnEventLoopScheduler)
                .Subscribe(onNext: async tripleFromClient =>
                {
                    using var graphEngineResponseTask = Task.Factory.StartNew(async() =>
                    {
                        //await Task.Yield();

                        await Task.Delay(0).ConfigureAwait(false);

                        Log.WriteLine($"Processing Timestamp: {DateTime.Now.ToString(CultureInfo.InvariantCulture)}");
                        Log.WriteLine($"Triple Received from Client has been saved Received.");
                        Log.WriteLine($"Triple Subject Node  : {tripleFromClient.Subject}");
                        Log.WriteLine($"Triple Predicate Node: {tripleFromClient.Predicate}");
                        Log.WriteLine($"Triple Object Node   : {tripleFromClient.Object}");
                    }, cancellationToken: CancellationToken.None,
                                                                              creationOptions: TaskCreationOptions.HideScheduler,
                                                                              scheduler: TaskScheduler.Current).Unwrap().ContinueWith(async _ =>
                    {
                        await Task.Delay(0);

                        Log.WriteLine("Task TriplePostedToServerReceivedAction Complete...");
                    }, cancellationToken: CancellationToken.None);

                    var writeToConsoleTask = graphEngineResponseTask;

                    await writeToConsoleTask;
                });

                // Reactive Event: ServerStreamedTripleSavedToMemoryCloudAction
                // Description: Setup Reactive Subscription on Cold Observable. Logic is trigger/executed whenever
                // a client call RPC Method "PostTripleToServer."

                GraphEngineTripleServerAPI.ServerStreamedTripleSavedToMemoryCloudAction
                .ObserveOn(GraphEngineTripleServerAPI.ObserverOnNewThreadScheduler)
                .Do(onNext: subscriberSource =>
                {
                    var msg = "ServerStreamedTripleSavedToMemoryCloudAction-1";
                    Log.WriteLine("{0} Subscription happened on this Thread: {1}", msg,
                                  Thread.CurrentThread.ManagedThreadId);
                })
                .SubscribeOn(GraphEngineTripleServerAPI.SubscribeOnEventLoopScheduler)
                .Subscribe(onNext: async savedTriple =>
                {
                    using var graphEngineResponseTask = Task.Factory.StartNew(async() =>
                    {
                        //await Task.Yield();

                        await Task.Delay(0).ConfigureAwait(false);

                        Log.WriteLine($"Processing Timestamp: {DateTime.Now.ToString(CultureInfo.InvariantCulture)}");
                        Log.WriteLine($"Triple Streamed to Pushed Client has been saved to MemoryCloud.");
                        Log.WriteLine($"TripleStore CellID   : {savedTriple.NewTripleStore.CellId}");
                        Log.WriteLine($"Triple Subject Node  : {savedTriple.NewTripleStore.TripleCell.Subject}");
                        Log.WriteLine($"Triple Predicate Node: {savedTriple.NewTripleStore.TripleCell.Predicate}");
                    }, cancellationToken: CancellationToken.None,
                                                                              creationOptions: TaskCreationOptions.HideScheduler,
                                                                              scheduler: TaskScheduler.Current).Unwrap().ContinueWith(async _ =>
                    {
                        await Task.Delay(0).ConfigureAwait(false);

                        Log.WriteLine("Task ServerStreamedTripleSavedToMemoryCloudAction Complete...");
                    }, cancellationToken: CancellationToken.None);

                    var writeToConsoleTask = graphEngineResponseTask;

                    await writeToConsoleTask;
                });

                // ClientPostedTripleStoreReadyInMemoryCloudAction

                GraphEngineTripleServerAPI.ClientPostedTripleStoreReadyInMemoryCloudAction
                .ObserveOn(GraphEngineTripleServerAPI.ObserverOnNewThreadScheduler)
                .Do(onNext: subscriberSource =>
                {
                    var msg = "ClientPostedTripleStoreReadyInMemoryCloudAction-1";
                    Log.WriteLine("{0} Subscription happened on this Thread: {1}", msg,
                                  Thread.CurrentThread.ManagedThreadId);
                })
                .SubscribeOn(GraphEngineTripleServerAPI.SubscribeOnEventLoopScheduler)
                .Synchronize()
                .Subscribe(onNext: async tripleObject =>
                {
                    using var getTripleByCellIdTask = Task.Factory.StartNew(async() =>
                    {
                        // await Task.Yield();
                        await Task.Delay(0).ConfigureAwait(false);

                        var isLocalCell = Global.CloudStorage.IsLocalCell(tripleObject.CellId);

                        if (isLocalCell)
                        {
                            Log.WriteLine($"Found TripleStore Object: {tripleObject.CellId} in Local MemoryCloud!");

                            using var getRequest = new TripleGetRequestWriter()
                                  {
                                      TripleCellId = tripleObject.CellId,
                                      Subject      = tripleObject.TripleCell.Subject,
                                      Predicate    = tripleObject.TripleCell.Predicate,
                                      Namespace    = tripleObject.TripleCell.Namespace,
                                      Object       = tripleObject.TripleCell.Object
                                  };

                            Log.WriteLine($"Make Client-Side call from Server-side: GetTripleByCellId.");

                            await GraphEngineTripleServerAPI.GetTripleByCellId(0, getRequest).ConfigureAwait(false);
                        }
                    }, cancellationToken: CancellationToken.None,
                                                                            creationOptions: TaskCreationOptions.HideScheduler,
                                                                            scheduler: TaskScheduler.Current).Unwrap().ContinueWith(async _ =>
                    {
                        await Task.Delay(0).ConfigureAwait(false);

                        Log.WriteLine("Task ClientPostedTripleStoreReadyInMemoryCloudAction Complete...");
                    }, cancellationToken: CancellationToken.None);

                    var writeToConsoleTask = getTripleByCellIdTask;

                    await writeToConsoleTask;
                });

                // Reactive: ClientPostedTripleStoreReadyInMemoryCloudHotAction

                GraphEngineTripleServerAPI.ClientPostedTripleStoreReadyInMemoryCloudHotAction
                .ObserveOn(GraphEngineTripleServerAPI.HotObservableSchedulerContext)
                .Do(onNext: subscriberSource =>
                {
                    var msg = "ClientPostedTripleStoreReadyInMemoryCloudHotAction-1";
                    Log.WriteLine("{0} Subscription happened on this Thread: {1}", msg,
                                  Thread.CurrentThread.ManagedThreadId);
                })
                .SubscribeOn(GraphEngineTripleServerAPI.HotObservableSchedulerContext)
                .Synchronize()
                .Subscribe(onNext: async tripleObject =>
                {
                    using var getTripleByCellIdTask = Task.Factory.StartNew(async() =>
                    {
                        // await Task.Yield();
                        await Task.Delay(0).ConfigureAwait(false);

                        //using var getRequest = new TripleGetRequestWriter()
                        //{
                        //    TripleCellId = tripleObject.CellId,
                        //    Subject = tripleObject.TripleCell.Subject,
                        //    Predicate = tripleObject.TripleCell.Predicate,
                        //    Namespace = tripleObject.TripleCell.Namespace,
                        //    Object = tripleObject.TripleCell.Object
                        //};

                        //await GraphEngineTripleServerAPI.GetTripleByCellId(0, getRequest).ConfigureAwait(false);

                        var isLocalCell = Global.CloudStorage.IsLocalCell(tripleObject.CellId);

                        if (isLocalCell)
                        {
                            Log.WriteLine($"Found TripleStore Object: {tripleObject.CellId} in Local MemoryCloud!");

                            using var getRequest = new TripleGetRequestWriter()
                                  {
                                      TripleCellId = tripleObject.CellId,
                                      Subject      = tripleObject.TripleCell.Subject,
                                      Predicate    = tripleObject.TripleCell.Predicate,
                                      Namespace    = tripleObject.TripleCell.Namespace,
                                      Object       = tripleObject.TripleCell.Object
                                  };

                            Log.WriteLine($"Make Client-Side call from Server-side: GetTripleByCellId.");

                            await GraphEngineTripleServerAPI
                            .GetTripleByCellId(0, getRequest).ConfigureAwait(false);
                        }
                    }, cancellationToken: CancellationToken.None,
                                                                            creationOptions: TaskCreationOptions.HideScheduler,
                                                                            scheduler: TaskScheduler.Current).Unwrap().ContinueWith(async _ =>
                    {
                        await Task.Delay(0).ConfigureAwait(false);

                        Log.WriteLine("Task ClientPostedTripleStoreReadyInMemoryCloudHotAction Complete...");
                    }, cancellationToken: CancellationToken.None);

                    var writeToConsoleTask = getTripleByCellIdTask;

                    await writeToConsoleTask;
                });

                GraphEngineTripleServerAPI.ClientPostedTripleStoreReadyInMemoryCloudHotAction.Connect();

                GraphEngineTripleServerAPI.TripleByCellIdReceivedAction
                .ObserveOn(GraphEngineTripleServerAPI.ObserverOnNewThreadScheduler)
                .Do(onNext: subscriberSource =>
                {
                    var msg = "TripleByCellIdReceivedAction-1";
                    Log.WriteLine("{0} Subscription happened on this Thread: {1}", msg,
                                  Thread.CurrentThread.ManagedThreadId);
                })
                .SubscribeOn(GraphEngineTripleServerAPI.SubscribeOnEventLoopScheduler)
                .Synchronize()
                .Subscribe(onNext: async tripleObjectFromGetRequest =>
                {
                    using var getTripleBySubjectTask = Task.Factory.StartNew(async() =>
                    {
                        //await Task.Yield();

                        await Task.Delay(0).ConfigureAwait(false);

                        Log.WriteLine("Reactive Async - Server-Side Get Request on behalf of the Client.");
                        Log.WriteLine($"Processing Timestamp: {DateTime.Now.ToString(CultureInfo.InvariantCulture)}");
                        Log.WriteLine($"Triple Object CellID : {tripleObjectFromGetRequest.CellId}.");
                        Log.WriteLine($"Triple Subject Node  : {tripleObjectFromGetRequest.TripleCell.Subject}");
                        Log.WriteLine($"Triple Predicate Node: {tripleObjectFromGetRequest.TripleCell.Predicate}");
                        Log.WriteLine($"Triple Object Node   : {tripleObjectFromGetRequest.TripleCell.Object}.");
                    }, cancellationToken: CancellationToken.None,
                                                                             creationOptions: TaskCreationOptions.HideScheduler,
                                                                             scheduler: TaskScheduler.Current).Unwrap().ContinueWith(async _ =>
                    {
                        await Task.Delay(0).ConfigureAwait(false);

                        Log.WriteLine("Task TripleByCellIdReceivedAction Complete...");
                    }, cancellationToken: CancellationToken.None);

                    var writeToConsoleTask = getTripleBySubjectTask;

                    await writeToConsoleTask;
                });

                GraphEngineTripleServerAPI.ClientPostedTripleSavedToMemoryCloudAction
                .ObserveOn(GraphEngineTripleServerAPI.ObserverOnNewThreadScheduler)
                .Do(onNext: subscriberSource =>
                {
                    var msg = "ClientPostedTripleSavedToMemoryCloudAction-1";
                    Log.WriteLine("{0} Subscription happened on this Thread: {1}", msg,
                                  Thread.CurrentThread.ManagedThreadId);
                })
                .SubscribeOn(GraphEngineTripleServerAPI.SubscribeOnEventLoopScheduler)
                .Synchronize()
                .Subscribe(onNext: async tripleStoreMemoryContext =>
                {
                    using var reactToTriplePostedSavedToMemoryCloudTask = Task.Factory.StartNew(async() =>
                    {
                        //await Task.Yield();

                        await Task.Delay(0).ConfigureAwait(false);

                        Log.WriteLine("Success! Found the Triple in the TripleStore MemoryCloud");

                        var tripleStore   = tripleStoreMemoryContext.NewTripleStore;
                        var subjectNode   = tripleStore.TripleCell.Subject;
                        var predicateNode = tripleStore.TripleCell.Predicate;
                        var objectNode    = tripleStore.TripleCell.Object;

                        Log.WriteLine($"Triple CellId in MemoryCloud: {tripleStoreMemoryContext.NewTripleStore.CellId}");
                        Log.WriteLine($"Subject Node: {subjectNode}");
                        Log.WriteLine($"Predicate Node: {predicateNode}");
                        Log.WriteLine($"Object Node: {objectNode}");
                    }, cancellationToken: CancellationToken.None,
                                                                                                creationOptions: TaskCreationOptions.HideScheduler,
                                                                                                scheduler: TaskScheduler.Current).Unwrap().ContinueWith(async _ =>
                    {
                        await Task.Delay(0).ConfigureAwait(false);

                        Log.WriteLine("Task ClientPostedTripleSavedToMemoryCloudAction Complete...");
                    }, cancellationToken: CancellationToken.None);

                    var storeFromMemoryCloudTask = reactToTriplePostedSavedToMemoryCloudTask;

                    await storeFromMemoryCloudTask;
                });
            }

            //Console.ReadLine();

            Log.WriteLine("Graph Engine Server is up, running and waiting to client connections");

            //Thread.Sleep(Timeout.Infinite);

            //GraphEngineTripleStoreDemoServerImpl =
            //    TripleStoreServer.GetCommunicationModule<TripleStoreDemoServerModule>();

            while (true)
            {
                // Each time we pass through the look check to see how many active clients are connected

                using var processingLoopTask = Task.Factory.StartNew(async() =>
                {
                    if (GraphEngineTripleClientAPI.Clients.Any())
                    {
                        var tripleStoreClients = GraphEngineTripleClientAPI.Clients.ToList();

                        Log.WriteLine($"The number of real-time Connected TripleStore Client: {tripleStoreClients.Count}.");

                        foreach (var connectedTripleStoreClient in tripleStoreClients.Where(connectedTripleStoreClient => connectedTripleStoreClient != null))
                        {
                            try
                            {
                                List <Triple> triples = new List <Triple> {
                                    new Triple {
                                        Subject = "GraphEngineServer", Predicate = "is", Object = "Running"
                                    }
                                };

                                // New-up the Request Message!

                                using var message = new TripleStreamWriter(triples);

                                // Push a triple to the Client

                                await connectedTripleStoreClient.StreamTriplesAsync(message).ConfigureAwait(false);
                            }
                            catch (Exception ex)
                            {
                                Log.WriteLine(ex.ToString());
                            }
                        }
                    }

                    await Task.Delay(1000).ConfigureAwait(false);
                }, cancellationToken: CancellationToken.None,
                                                                     creationOptions: TaskCreationOptions.HideScheduler,
                                                                     scheduler: TaskScheduler.Current).Unwrap();

                var mainLoopTask = processingLoopTask;

                await mainLoopTask;
            }
        }