Exemple #1
0
        public override void Startup()
        {
            _httpServer.HttpRequestReceived += OnHttpRequestReceived;
            _httpServer.WebSocketConnected  += AttachWebSocket;

            _apiDispatcherService.RegisterAdapter(this);
        }
Exemple #2
0
        public override void Startup()
        {
            _apiService.RegisterAdapter(this);

            var settings = _settingsService.GetSettings <AzureCloudServiceSettings>();

            if (!settings.IsEnabled || !string.IsNullOrEmpty(settings.ControllerId))
            {
                return;
            }

            SetupOutboundQueue(settings);
            SetupInboundQueue(settings);
        }
        public override void Startup()
        {
            if (!_settings.IsEnabled)
            {
                _log.Info("Cloud Connector service is disabled.");
                return;
            }

            _log.Info("Starting Cloud Connector service.");

            _apiDispatcherService.RegisterAdapter(this);

            Task.Run(ReceivePendingMessagesAsyncLoop, _cancellationTokenSource.Token);
        }
Exemple #4
0
        public HttpServerService(IConfigurationService configurationService, IApiDispatcherService apiDispatcherService, ILogService logService)
        {
            if (configurationService == null)
            {
                throw new ArgumentNullException(nameof(configurationService));
            }
            if (apiDispatcherService == null)
            {
                throw new ArgumentNullException(nameof(apiDispatcherService));
            }
            _log = logService.CreatePublisher(nameof(HttpServerService)) ?? throw new ArgumentNullException(nameof(logService));

            _httpServer = new HttpServer(logService);

            _httpServer.HttpRequestReceived += OnHttpRequestReceived;
            _httpServer.WebSocketConnected  += AttachWebSocket;

            var configuration = configurationService.GetConfiguration <HttpServerServiceConfiguration>("HttpServerService");

            _httpServer.BindAsync(configuration.Port).GetAwaiter().GetResult();

            apiDispatcherService.RegisterAdapter(this);
        }