public async Task ExecuteAsync() { AbstractProcessorFactory processorFactory = new KraftProcessorFactory(); IProcessorHandler processor = processorFactory.CreateProcessor(_HttpContext, _KraftModuleCollection, _NodesSetService); IProcessingContextCollection processingContexts = processor.GenerateProcessingContexts(_ServiceProvider.GetService <KraftGlobalConfigurationSettings>(), _KraftGlobalConfigurationSettings.GeneralSettings.KraftRequestFlagsKey); if (processingContexts == null) { Utilities.ExtensionMethods.KraftResult(_HttpContext, HttpStatusCode.InternalServerError, $"ExecuteAsync.CreateProcessingContexts returned null."); return; } Task[] tasks = new Task[processingContexts.Length]; int i = 0; try { _IsSystemInMaintenanceMode = processingContexts.IsMaintenance; foreach (IProcessingContext processingContext in processingContexts.ProcessingContexts) { tasks[i++] = Task.Run(() => { ExecuteReEntrance(processingContext, processingContexts.IsMaintenance); }); } await Task.WhenAll(tasks); } finally { _IsSystemInMaintenanceMode = false; processor.GenerateResponse(); } }
public StorageHandler( IEventSubscription subscription, long id, IProcessorHandler <FilterLog> logHandler) : base(subscription, id) { LogHandler = logHandler; }
public async Task ExecuteAsync() { //REQUESTRECORDER if (_KraftGlobalConfigurationSettings.GeneralSettings.ToolsSettings.RequestRecorder.IsEnabled) { ISecurityModel securityModel; if (_KraftGlobalConfigurationSettings.GeneralSettings.AuthorizationSection.RequireAuthorization) { securityModel = new SecurityModel(_HttpContext); } else { securityModel = new SecurityModelMock(_KraftGlobalConfigurationSettings.GeneralSettings.AuthorizationSection); } if (securityModel.IsAuthenticated) { RecordersStoreImp recordersStoreImp = _HttpContext.RequestServices.GetRequiredService <RecordersStoreImp>(); IRequestRecorder requestRecorder = recordersStoreImp.Get(securityModel.UserName); if (requestRecorder != null && requestRecorder.IsRunning) { await requestRecorder.HandleRequest(_HttpContext.Request); } } } AbstractProcessorFactory processorFactory = new KraftProcessorFactory(); IProcessorHandler processor = processorFactory.CreateProcessor(_HttpContext, _KraftModuleCollection, _NodesSetService, _ServiceProvider.GetService <KraftGlobalConfigurationSettings>()); IProcessingContextCollection processingContexts = processor.GenerateProcessingContexts(_KraftGlobalConfigurationSettings.GeneralSettings.KraftRequestFlagsKey); if (processingContexts == null) { Utilities.ExtensionMethods.KraftResult(_HttpContext, HttpStatusCode.InternalServerError, $"ExecuteAsync.CreateProcessingContexts returned null."); return; } Task[] tasks = new Task[processingContexts.Length]; int i = 0; try { _IsSystemInMaintenanceMode = processingContexts.IsMaintenance; foreach (IProcessingContext processingContext in processingContexts.ProcessingContexts) { tasks[i++] = Task.Run(() => { ExecuteReEntrance(processingContext, processingContexts.IsMaintenance); }); } await Task.WhenAll(tasks); } finally { _IsSystemInMaintenanceMode = false; processor.GenerateResponse(); } }
public ProcessingContext(IProcessorHandler processorHandler) { ProcessorHandler = processorHandler; ReturnModel = new ReturnModel(); #if NO_TRACE_ID // Do not generate unique id on each processing context #else _TraceId = Interlocked.Increment(ref _TraceId); #endif }
public virtual void AddProcessorHandler(IProcessorHandler <T> processorHandler) { ProcessorHandlers.Add(processorHandler); }
public static void AddStorageHandler(this EventSubscription subscription, IProcessorHandler <FilterLog> logHandler, long id = 0) { subscription.AddHandler(new StorageHandler(subscription, id, logHandler)); }