/// <summary> /// Sets the cluster channel provider. /// </summary> /// <param name="clusterChannelProvider">IClusterChannel instance.</param> public RepositoryBuilder UseClusterChannelProvider(IClusterChannel clusterChannelProvider) { Configuration.Providers.Instance.ClusterChannelProvider = clusterChannelProvider; WriteLog("ClusterChannelProvider", clusterChannelProvider); return(this); }
private void StartManagers() { object dummy; IClusterChannel channel = null; try { BlobStorageComponents.DataProvider = Providers.Instance.BlobMetaDataProvider; BlobStorageComponents.ProviderSelector = Providers.Instance.BlobProviderSelector; ConsoleWrite("Initializing cache ... "); dummy = Cache.Count; ConsoleWriteLine("ok."); ConsoleWrite("Starting message channel ... "); channel = DistributedApplication.ClusterChannel; ConsoleWriteLine("ok."); ConsoleWrite("Sending greeting message ... "); new PingMessage(new string[0]).SendAsync(CancellationToken.None).GetAwaiter().GetResult(); ConsoleWriteLine("ok."); ConsoleWrite("Starting NodeType system ... "); dummy = ActiveSchema.NodeTypes[0]; ConsoleWriteLine("ok."); ConsoleWrite("Starting ContentType system ... "); dummy = ContentType.GetByName("GenericContent"); ConsoleWriteLine("ok."); ConsoleWrite("Starting AccessProvider ... "); dummy = User.Current; ConsoleWriteLine("ok."); SnQuery.SetPermissionFilterFactory(Providers.Instance.PermissionFilterFactory); if (_settings.StartIndexingEngine) { StartIndexingEngine(); } else { ConsoleWriteLine("IndexingEngine is not started."); } // switch on message processing after IndexingEngine was started. channel.AllowMessageProcessing = true; if (_settings.StartWorkflowEngine) { StartWorkflowEngine(); } else { ConsoleWriteLine("Workflow subsystem is not started."); } ConsoleWrite("Loading string resources ... "); dummy = SenseNetResourceManager.Current; ConsoleWriteLine("ok."); serviceInstances = new List <ISnService>(); foreach (var serviceType in TypeResolver.GetTypesByInterface(typeof(ISnService))) { var service = (ISnService)Activator.CreateInstance(serviceType); service.Start(); ConsoleWriteLine("Service started: ", serviceType.Name); serviceInstances.Add(service); } // register this application in the task management component SnTaskManager.RegisterApplication(); } catch { // If an error occoured, shut down the cluster channel. channel?.ShutDownAsync(CancellationToken.None).GetAwaiter().GetResult(); throw; } }