public void Close() { try { AppSolutionAutoSave.StopSolutionAutoSave(); if (SolutionRepository != null) { CloseAllRunningAgents(); PlugInsManager.CloseAllRunningPluginProcesses(); SolutionRepository.StopAllRepositoryFolderWatchers(); } if (!RunningInExecutionMode) { UserProfile.GingerStatus = eGingerStatus.Closed; UserProfile.SaveUserProfile(); AppSolutionAutoSave.CleanAutoSaveFolders(); } if (WorkSpace.Instance.LocalGingerGrid != null) { WorkSpace.Instance.LocalGingerGrid.Stop(); } WorkSpace.Instance.Telemetry.SessionEnd(); mWorkSpace = null; } catch (Exception ex) { Reporter.ToLog(eLogLevel.DEBUG, "Exception during close workspace", ex); } }
public void CloseSolution() { //Do cleanup if (SolutionRepository != null) { PlugInsManager.CloseAllRunningPluginProcesses(); CloseAllRunningAgents(); CloseAllEnvironments(); SolutionRepository.StopAllRepositoryFolderWatchers(); if (!RunningInExecutionMode) { AppSolutionAutoSave.SolutionAutoSaveEnd(); } } //Reset values if (!DoNotResetWorkspaceArgsOnClose) { mPluginsManager = new PluginsManager(); SolutionRepository = null; SourceControl = null; Solution = null; } EventHandler.SolutionClosed(); }
public void Close() { AppSolutionAutoSave.StopSolutionAutoSave(); if (SolutionRepository != null) { CloseAllRunningAgents(); PlugInsManager.CloseAllRunningPluginProcesses(); SolutionRepository.StopAllRepositoryFolderWatchers(); } if (!RunningInExecutionMode) { UserProfile.GingerStatus = eGingerStatus.Closed; UserProfile.SaveUserProfile(); AppSolutionAutoSave.CleanAutoSaveFolders(); } WorkSpace.Instance.LocalGingerGrid.Stop(); WorkSpace.Instance.Telemetry.SessionEnd(); mWorkSpace = null; }
/// <summary> /// /// </summary> /// <param name="plugIsManager"></param> /// <param name="kafkaConfig"></param> /// <param name="logger"></param> public PlugInsController(PlugInsManager plugIsManager, KafkaServiceConfigBE kafkaConfig, ILogger <PlugInsController> logger) { _logger = logger; _plugIsManager = plugIsManager; _kafkaConfig = kafkaConfig; }
// This method gets called by the runtime. Use this method to add services to the container. // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940 public void ConfigureServices(IServiceCollection services) { // configure logging Log.Logger = new LoggerConfiguration() .WriteTo.Sink(new HangfireConsoleSink()) //.WriteTo.Console() .CreateLogger(); var logger = new SerilogLoggerProvider(Log.Logger).CreateLogger(nameof(Program)); services.AddSingleton(logger); services.AddControllers(); var plugInsConfig = Configuration.GetSection("plugInsConfig").Get <PlugInsConfigBE>(); // ========================== // load the hangfire config // NOTE: We are jsut using the In-Memory storage for the POC // A real implementation would use a DB backed store // ========================== var hangfireConfig = Configuration.GetSection("hangfireConfig").Get <HangfireServiceConfigBE>(); services.AddHangfire(config => config.SetDataCompatibilityLevel(CompatibilityLevel.Version_170) .UseSimpleAssemblyNameTypeSerializer() .UseDefaultTypeSerializer() .UseMemoryStorage() // config param PollIntervalInSecs does not apply to InMemory Storage .UseConsole()); services.AddHangfireServer(config => config.WorkerCount = hangfireConfig.WorkerCount != -1 ? hangfireConfig.WorkerCount : Math.Min(Environment.ProcessorCount * 5, MAX_DEFAULT_WORKER_COUNT)); // ========================= // config swagger // ========================= services.AddMvc(c => { c.Conventions.Add(new ApiExplorerGroupPerVersionConvention()); // decorate Controllers to distinguish SwaggerDoc (v1, v2, etc.) }); // all of the entities with sample requests are in the current assembly //services.AddSwaggerExamplesFromAssemblyOf<RaftFindAuthXctRequestBE>(); services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new OpenApiInfo { Title = "Scheduler Service POC WebAPI", Version = "v1", Description = @"Documentation for Public WebAPI to administer Recurring Jobs is the Scheduler Service. ### Technologies Leveraged: * Hangfire as the scheduling engine. * System.Composition to implement a Plug-In Model. * Kafka to push tasks to subscribers. ### Important Endpoints: | Endpoint | Desciption | |----------|------------| | `https://localhost:<port>/hangfire` | Hangfire Dashboard | | `https://localhost:<port>/swagger` | Swagger website for recurring Job WebAPI | ### Version History: | Date| Version | Description | |----------|----------|----------| | 2020/04/14 | v1.0 | Initial Release |", Contact = new OpenApiContact { Name = "US ESA Team", Email = "*****@*****.**", Url = new Uri("https://www.fisglobal.com/"), }, License = new OpenApiLicense { Name = "Property of FIS Global", Url = new Uri("https://www.fisglobal.com/"), } }); //c.ExampleFilters(); c.EnableAnnotations(); // Set the comments path for the Swagger JSON and UI for this assy var xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml"; var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile); c.IncludeXmlComments(xmlPath); // to avoid issue with BEs in two different namespaces that have the same class name c.CustomSchemaIds(i => i.FullName); }); // ========================== // load the kafka config that is available to all plug-ins // ========================== var kafkaConfig = Configuration.GetSection("kafkaConfig").Get <KafkaServiceConfigBE>(); services.AddSingleton(kafkaConfig); // ========================== // load the plug-in assys // ========================== var plugInsManager = new PlugInsManager(plugInsConfig, kafkaConfig); services.AddSingleton(plugInsManager); }
/// <summary> /// Initializes a new instance of the <see cref="HangfireManager"/> class. /// </summary> /// <param name="plugInsManager">The PlugIn Manager.</param> /// <param name="kafkaConfig">The kafka configuration.</param> public HangfireManager(PlugInsManager plugInsManager, KafkaServiceConfigBE kafkaConfig) { _plugInsManager = plugInsManager; _kafkaConfig = kafkaConfig; }