/// <summary> /// Starts the TaskHubWorker so it begins processing orchestrations and activities /// </summary> /// <returns></returns> public async Task <TaskHubWorker> StartAsync() { await this.slimLock.WaitAsync(); try { if (this.isStarted) { throw new InvalidOperationException("Worker is already started"); } this.orchestrationDispatcher = new TaskOrchestrationDispatcher( orchestrationService, this.orchestrationManager, this.orchestrationDispatchPipeline); this.activityDispatcher = new TaskActivityDispatcher( orchestrationService, this.activityManager, this.activityDispatchPipeline); await orchestrationService.StartAsync(); await this.orchestrationDispatcher.StartAsync(); await this.activityDispatcher.StartAsync(); this.isStarted = true; } finally { this.slimLock.Release(); } return(this); }
/// <summary> /// Starts the TaskHubWorker so it begins processing orchestrations and activities /// </summary> /// <returns></returns> public async Task <TaskHubWorker> StartAsync() { await this.slimLock.WaitAsync(); try { if (this.isStarted) { throw new InvalidOperationException("Worker is already started"); } this.logHelper.TaskHubWorkerStarting(); var sw = Stopwatch.StartNew(); this.orchestrationDispatcher = new TaskOrchestrationDispatcher( this.orchestrationService, this.orchestrationManager, this.orchestrationDispatchPipeline, this.logHelper, this.ErrorPropagationMode); this.activityDispatcher = new TaskActivityDispatcher( this.orchestrationService, this.activityManager, this.activityDispatchPipeline, this.logHelper, this.ErrorPropagationMode); await this.orchestrationService.StartAsync(); await this.orchestrationDispatcher.StartAsync(); await this.activityDispatcher.StartAsync(); this.logHelper.TaskHubWorkerStarted(sw.Elapsed); this.isStarted = true; } finally { this.slimLock.Release(); } return(this); }