Beispiel #1
0
        public ComponentRegistryService(
            StorageService storageService,
            SystemStatusService systemStatusService,
            MessageBusService messageBusService,
            AppService appService,
            ComponentInitializerService componentInitializerService,
            ILogger <ComponentRegistryService> logger)
        {
            _storageService              = storageService ?? throw new ArgumentNullException(nameof(storageService));
            _messageBusService           = messageBusService ?? throw new ArgumentNullException(nameof(messageBusService));
            _componentInitializerService = componentInitializerService ?? throw new ArgumentNullException(nameof(componentInitializerService));
            _logger = logger ?? throw new ArgumentNullException(nameof(logger));

            _messageBusWrapper = new ComponentRegistryMessageBusWrapper(messageBusService);

            if (systemStatusService == null)
            {
                throw new ArgumentNullException(nameof(systemStatusService));
            }
            systemStatusService.Set("component_registry.count", () => _components.Count);

            if (appService is null)
            {
                throw new ArgumentNullException(nameof(appService));
            }
            appService.RegisterStatusProvider("components", () =>
            {
                return(GetComponents().Select(c => ComponentsController.CreateComponentModel(c)));
            });
        }