コード例 #1
0
        /// <summary>
        /// This is the entry point of the service host process.
        /// </summary>
        private static void Main()
        {
            // The ServiceManifest.XML file defines one or more service type names.
            // Registering a service maps a service type name to a .NET type.
            // When Service Fabric creates an instance of this service type,
            // an instance of the class is created in this host process.

            // When StartService returns, it is guaranteed that Global.CloudStorage
            // is fully operational, and Global.CommunicationInstance is successfully
            // started.

            TrinityConfig.LoggingLevel = LogLevel.Debug;

            GraphEngineService.StartServiceAsync("Trinity.ServiceFabric.GraphEngine.GraphDataServiceType")
            .GetAwaiter()
            .GetResult();

            // Global.Communications runtime is ready

            var sampleModuleImplementation = Global.CommunicationInstance;

            var graphEngineModules = Global.CommunicationInstance.GetRegisteredCommunicationModuleTypes();

            foreach (var _ in graphEngineModules.Where(module => module.Assembly.FullName == nameof(SampleModuleImpl)).Select(module => new { }))
            {
                var p = Global.CommunicationInstance.CloudStorage.MyPartitionId;
                sampleModule = Global.CommunicationInstance.GetCommunicationModule <SampleModuleImpl>();
                sampleModule.Ping(p);
            }

            // Also, pay attention that, only *master replicas of the partitions* reach here.
            // When the cluster is shutting down, it is possible that the secondary replicas
            // become the master. However, these "transient" masters will be blocked, and
            // do not reach this point.

            Log.WriteLine(nameof(SampleModuleImpl) + " is Up, Ready and Active");

            var memcloud = Global.CloudStorage as DynamicMemoryCloud;

            // Prevents this host process from terminating so services keep running.
            Thread.Sleep(Timeout.Infinite);
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: InKnowWorks/GraphEngine
        /// <summary>
        /// This is the entry point of the service host process.
        /// </summary>
        private static void Main()
        {
            try
            {
                // The ServiceManifest.XML file defines one or more service type names.
                // Registering a service maps a service type name to a .NET type.
                // When Service Fabric creates an instance of this service type,
                // an instance of the class is created in this host process.

                //ServiceRuntime.RegisterServiceAsync("SFCluster.Stateful.TripleStore.GraphDataClientType",
                //    context => new GraphDataClient(context)).GetAwaiter().GetResult();

                TrinityConfig.LogEchoOnConsole = false;
                TrinityConfig.LoggingLevel     = LogLevel.Debug;
                //TrinityConfig.StorageRoot = @"C:\GE-TripleStore-Storage";

                // The ServiceManifest.XML file defines one or more service type names.
                // Registering a service maps a service type name to a .NET type.
                // When Service Fabric creates an instance of this service type,
                // an instance of the class is created in this host process.

                GraphEngineService.StartServiceAsync("SFCluster.Stateful.TripleStore.GraphDataClientType").GetAwaiter()
                .GetResult();

                Log.WriteLine(nameof(TripleModule) + " SFCluster Client is Up, Ready and Active");

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

                m_trinity.Start();

                //ServiceEventSource.Current.ServiceTypeRegistered(Process.GetCurrentProcess().Id, typeof(GraphDataClient).Name);

                // Prevents this host process from terminating so services keep running.
                Thread.Sleep(Timeout.Infinite);
            }
            catch (Exception e)
            {
                //ServiceEventSource.Current.ServiceHostInitializationFailed(e.ToString());
                throw;
            }
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: d3m0n5/GDB
        /// <summary>
        /// This is the entry point of the service host process.
        /// </summary>
        private static void Main()
        {
            // The ServiceManifest.XML file defines one or more service type names.
            // Registering a service maps a service type name to a .NET type.
            // When Service Fabric creates an instance of this service type,
            // an instance of the class is created in this host process.

            // When StartService returns, it is guaranteed that Global.CloudStorage
            // is fully operational, and Global.CommunicationInstance is successfully
            // started.
            GraphEngineService.StartServiceAsync("Trinity.ServiceFabric.GraphEngineServiceType").GetAwaiter().GetResult();

            // Also, pay attention that, only *master replicas of the partitions* reach here.
            // When the cluster is shutting down, it is possible that the secondary replicas
            // become the master. However, these "transient" masters will be blocked, and
            // do not reach this point.
            Log.WriteLine("Hello world from GE-SF integration!");
            var memcloud = Global.CloudStorage as DynamicMemoryCloud;

            // Prevents this host process from terminating so services keep running.
            Thread.Sleep(Timeout.Infinite);
        }
コード例 #4
0
        private static void Main()
        {
            try
            {
                // The ServiceManifest.XML file defines one or more service type names.
                // Registering a service maps a service type name to a .NET type.
                // When Service Fabric creates an instance of this service type,
                // an instance of the class is created in this host process.

                // When StartService returns, it is guaranteed that Global.CloudStorage
                // is fully operational, and Global.CommunicationInstance is successfully
                // started.

                // Trinity-GraphEngine Azure Service Fabric initialization Step 1:

                GraphEngineService.StartServiceAsync(TripleStoreMemoryCloudServiceTypeString).GetAwaiter().GetResult();

                ServiceEventSource.Current.ServiceTypeRegistered(Process.GetCurrentProcess().Id, typeof(GraphEngineService).Name);

                Log.WriteLine("Hello world from GE-SF integration!");

                //var dynamicMemoryCloud = Global.CloudStorage as DynamicMemoryCloud;

                //var localMemoryCloud = Global.LocalStorage;

                //var myTriple =
                //    new Triple()
                //    {
                //        GraphInstance = 0,
                //        HashCode = 1,
                //        Nodes = new System.Collections.Generic.List<INode>()
                //        {
                //            new INode()
                //            {
                //                GraphParent = 0,
                //                GraphUri    = "http://www.inknowworks.semanticweb.ontology/persongraph",
                //                HashCode    = 0,
                //                TypeOfNode  = NodeType.GraphLiteral
                //            }
                //        }
                //    };

                //var tripleCollection = new List<Triple> { myTriple };

                //Graph myGraph = new Graph()
                //{
                //    BaseUri = "http://www.inknowworks.semanticweb.ontology/",
                //    CellId = 0,
                //    TripleCollection = tripleCollection
                //};

                //dynamicMemoryCloud?.SaveGraph(myGraph);

                // Trinity-GraphEngine Azure Service Fabric initialization Step 2: I'm not sure this is right?!!! TT @ 01/10/2019

                // Also, pay attention that, only *master replicas of the partitions* reach here.
                // When the cluster is shutting down, it is possible that the secondary replicas
                // become the master. However, these "transient" masters will be blocked, and
                // do not reach this point.


                // This is the stock-original text-book API Azure.SDK for .NET call

                // Step 1:

                //ServiceRuntime.RegisterServiceAsync("IKW.GraphEngine.TripleStore.MemoryCloudServiceType",
                //    context => new MemoryCloudService(context)).GetAwaiter().GetResult();

                // Step 2:

                //ServiceEventSource.Current.ServiceTypeRegistered(Process.GetCurrentProcess().Id, typeof(MemoryCloudService).Name);

                // Prevents this host process from terminating so services keep running.
                Thread.Sleep(Timeout.Infinite);
            }
            catch (Exception e)
            {
                ServiceEventSource.Current.ServiceHostInitializationFailed(e.ToString());
                throw;
            }
        }
コード例 #5
0
        /// <summary>
        /// This is the entry point of the service host process.
        /// </summary>
        private static async Task Main()
        {
            try
            {
                TrinityConfig.LogEchoOnConsole = false;
                TrinityConfig.LoggingLevel     = LogLevel.Debug;

                //TrinityConfig.StorageRoot = @"C:\GE-TripleStore-Storage";

                // The ServiceManifest.XML file defines one or more service type names.
                // Registering a service maps a service type name to a .NET type.
                // When Service Fabric creates an instance of this service type,
                // an instance of the class is created in this host process.

                GraphEngineService.StartServiceAsync("Trinity.SF.GraphEngineDataServiceType").GetAwaiter()
                .GetResult();

                // Global.Communications runtime is ready

                TripleStoreServer = Global.CommunicationInstance as TrinityServer;

                if (TripleStoreServer != null)
                {
                    Log.WriteLine(nameof(TripleModule) + " is Up, Ready and Active");

                    TripleStoreServer.Started += TripleStoreServer_Started;
                    TripleStoreServer_Started();
                }

                //Console.ReadLine();

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

                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 != null)
                //        {
                //            var tripleStoreClients = GraphEngineTripleClientAPI.Clients.ToList();

                //            Console.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(2000).ConfigureAwait(false);

                //    }, cancellationToken: CancellationToken.None,
                //        creationOptions: TaskCreationOptions.HideScheduler,
                //        scheduler: TaskScheduler.Current).Unwrap();

                //    var mainLoopTask = processingLoopTask;

                //    await mainLoopTask;
                //}
            }
            catch (Exception ex)
            {
                Log.WriteLine(ex.Message);
            }
        }
コード例 #6
0
        /// <summary>
        /// This is the entry point of the service host process.
        /// </summary>
        private static async Task Main()
        {
            try
            {
                //TrinityConfig.LogEchoOnConsole = false;
                TrinityConfig.LoggingLevel = LogLevel.Debug;
                //TrinityConfig.StorageRoot = @"C:\GE-TripleStore-Storage";

                // The ServiceManifest.XML file defines one or more service type names.
                // Registering a service maps a service type name to a .NET type.
                // When Service Fabric creates an instance of this service type,
                // an instance of the class is created in this host process.

                GraphEngineService.StartServiceAsync("Stateful.TripleStore.GraphDataServiceType").GetAwaiter()
                .GetResult();

                Log.WriteLine(nameof(TripleModule) + " is Up, Ready and Active");

                // Global.Communications runtime is ready

                if (Global.CommunicationInstance != null)
                {
                    TripleStoreServer = Global.CommunicationInstance as TrinityServer;
                }

                if (TripleStoreServer != null)
                {
                    //Global.LocalStorage.LoadStorage();

                    TripleStoreServer.RegisterCommunicationModule <TrinityClientModule>();
                    TripleStoreServer.RegisterCommunicationModule <TripleModule>();

                    TrinityClientModuleRuntime = TripleStoreServer.GetCommunicationModule <TrinityClientModule>();

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

                    GraphEngineTripleModuleImpl = TripleStoreServer.GetCommunicationModule <TripleModule>();
                }

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

                    GraphEngineTripleModuleImpl.TriplePostedToServerReceivedAction
                    .ObserveOn(GraphEngineTripleModuleImpl.ObserverOnNewThreadScheduler)
                    .Do(onNext: subscriberSource =>
                    {
                        var msg = "TriplePostedToServerReceivedAction-1";
                        Log.WriteLine("{0} Subscription happened on this Thread: {1}", msg, Thread.CurrentThread.ManagedThreadId);
                    })
                    .SubscribeOn(GraphEngineTripleModuleImpl.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);

                            var msg = "TriplePostedToServerReceivedAction-1";
                            Log.WriteLine("{0} Subscription happened on this Thread: {1}", msg,
                                          Thread.CurrentThread.ManagedThreadId);

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

                        var writeToConsoleTask = graphEngineResponseTask;

                        await writeToConsoleTask;
                    });

                    GraphEngineTripleModuleImpl.ServerStreamedTripleSavedToMemoryCloudAction
                    .ObserveOn(GraphEngineTripleModuleImpl.ObserverOnNewThreadScheduler)
                    .Do(onNext: subscriberSource =>
                    {
                        var msg = "ServerStreamedTripleSavedToMemoryCloudAction-1";
                        Log.WriteLine("{0} Subscription happened on this Thread: {1}", msg,
                                      Thread.CurrentThread.ManagedThreadId);
                    })
                    .SubscribeOn(GraphEngineTripleModuleImpl.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);

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

                        var writeToConsoleTask = graphEngineResponseTask;

                        await writeToConsoleTask;
                    });

                    // ClientPostedTripleStoreReadyInMemoryCloudAction

                    GraphEngineTripleModuleImpl.ClientPostedTripleStoreReadyInMemoryCloudAction
                    .ObserveOn(GraphEngineTripleModuleImpl.ObserverOnNewThreadScheduler)
                    .Do(onNext: subscriberSource =>
                    {
                        var msg = "ClientPostedTripleStoreReadyInMemoryCloudAction-1";
                        Log.WriteLine("{0} Subscription happened on this Thread: {1}", msg,
                                      Thread.CurrentThread.ManagedThreadId);
                    })
                    .SubscribeOn(GraphEngineTripleModuleImpl.SubscribeOnEventLoopScheduler)
                    .Synchronize()
                    .Subscribe(onNext: async tripleObject =>
                    {
                        using var getTripleByCellIdTask = Task.Factory.StartNew(async() =>
                        {
                            //var t = Global.CloudStorage.IsLocalCell(tripleObject.CellId);

                            // 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 GraphEngineTripleModuleImpl.GetTripleByCellId(0, getRequest).ConfigureAwait(false);
                        }, cancellationToken: CancellationToken.None,
                                                                                creationOptions: TaskCreationOptions.HideScheduler,
                                                                                scheduler: TaskScheduler.Current).Unwrap().ContinueWith(async _ =>
                        {
                            await Task.Delay(0);

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

                        var writeToConsoleTask = getTripleByCellIdTask;

                        await writeToConsoleTask;
                    });

                    // Reactive: ClientPostedTripleStoreReadyInMemoryCloudHotAction

                    GraphEngineTripleModuleImpl.ClientPostedTripleStoreReadyInMemoryCloudHotAction
                    .ObserveOn(GraphEngineTripleModuleImpl.HotObservableSchedulerContext)
                    .Do(onNext: subscriberSource =>
                    {
                        var msg = "ClientPostedTripleStoreReadyInMemoryCloudHotAction-1";
                        Log.WriteLine("{0} Subscription happened on this Thread: {1}", msg,
                                      Thread.CurrentThread.ManagedThreadId);
                    })
                    .SubscribeOn(GraphEngineTripleModuleImpl.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 GraphEngineTripleModuleImpl.GetTripleByCellId(0, getRequest).ConfigureAwait(false);
                        }, cancellationToken: CancellationToken.None,
                                                                                creationOptions: TaskCreationOptions.HideScheduler,
                                                                                scheduler: TaskScheduler.Current).Unwrap().ContinueWith(async _ =>
                        {
                            await Task.Delay(0);

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

                        var writeToConsoleTask = getTripleByCellIdTask;

                        await writeToConsoleTask;
                    });

                    GraphEngineTripleModuleImpl.ClientPostedTripleStoreReadyInMemoryCloudHotAction.Connect();

                    GraphEngineTripleModuleImpl.TripleByCellIdReceivedAction
                    .ObserveOn(GraphEngineTripleModuleImpl.ObserverOnNewThreadScheduler)
                    .Do(onNext: subscriberSource =>
                    {
                        var msg = "TripleByCellIdReceivedAction-1";
                        Log.WriteLine("{0} Subscription happened on this Thread: {1}", msg,
                                      Thread.CurrentThread.ManagedThreadId);
                    })
                    .SubscribeOn(GraphEngineTripleModuleImpl.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 - Parallel-Tasking return from 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);

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

                        var writeToConsoleTask = getTripleBySubjectTask;

                        await writeToConsoleTask;
                    });

                    GraphEngineTripleModuleImpl.ClientPostedTripleSavedToMemoryCloudAction
                    .ObserveOn(GraphEngineTripleModuleImpl.ObserverOnNewThreadScheduler)
                    .Do(onNext: subscriberSource =>
                    {
                        var msg = "ClientPostedTripleSavedToMemoryCloudAction-1";
                        Log.WriteLine("{0} Subscription happened on this Thread: {1}", msg,
                                      Thread.CurrentThread.ManagedThreadId);
                    })
                    .SubscribeOn(GraphEngineTripleModuleImpl.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);

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

                        var storeFromMemoryCloudTask = reactToTriplePostedSavedToMemoryCloudTask;

                        await storeFromMemoryCloudTask;
                    });
                }


                //Console.ReadLine();

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

                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 (TrinityClientModuleRuntime.Clients != null)
                //        {
                //            var tripleStoreClients = TrinityClientModuleRuntime.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(2000).ConfigureAwait(false);

                //    }, cancellationToken: CancellationToken.None,
                //        creationOptions: TaskCreationOptions.HideScheduler,
                //        scheduler: TaskScheduler.Current).Unwrap();

                //    var mainLoopTask = processingLoopTask;

                //    await mainLoopTask;
                //}
            }
            catch (Exception ex)
            {
                Log.WriteLine(ex.Message);
            }
        }