public static void Initialize(IObjectProvider <Dictionary <string, FixtureOverview> > objectProvider)
        {
            // SS.Integration.Diagnostics.RestService uses Owin.HttpListeners.
            // that assembly must be referenced in the startup project even if not
            // directly used, so do not remove it from the list of references
            Logger.Info("Initializing adapter's supervisor.");
            try
            {
                //initialize default service configuration
                var serviceConfiguration = new ServiceConfiguration();

                //initialize streaming service
                var streamingService = serviceConfiguration.UsePushNotifications
                    ? (ISupervisorStreamingService)SupervisorStreamingService.Instance
                    : SupervisorNullStreamingService.Instance;

                //initialize supervisor actor
                _supervisorActor = AdapterActorSystem.ActorSystem.ActorOf(
                    Props.Create(() => new SupervisorActor(streamingService, objectProvider)),
                    SupervisorActor.ActorName);

                //initialize supervisor proxy
                _proxy = new SupervisorProxy(_supervisorActor);

                //initialize and start supervisor service
                _service = new Service(serviceConfiguration, _proxy);
                _service.Start();
            }
            catch (Exception e)
            {
                string errMsg =
                    "An error occured during the initialization of the adapter's supervisor.";
                Logger.Error(errMsg, e);
            }
        }
Exemplo n.º 2
0
        public Service(ISupervisorServiceConfiguration configuration, ISupervisorProxy proxy)
        {
            Configuration = configuration ?? throw new ArgumentNullException(nameof(configuration));
            Proxy         = proxy ?? throw new ArgumentNullException(nameof(proxy));

            Instance = this;
        }
Exemplo n.º 3
0
        public Service(ISupervisorProxy supervisor, ISupervisorServiceConfiguration configuration)
        {
            if (supervisor == null)
                throw new ArgumentNullException("supervisor");

            if (configuration == null)
                throw new ArgumentNullException("configuration");
            
            Supervisor = supervisor;
            ServiceConfiguration = configuration;
            ServiceInstance = this;
        }
Exemplo n.º 4
0
 public Service(ISupervisorProxy supervisor)
     : this(supervisor, GetDefaultConfiguration())
 {
 }