public async Task Run()
        {
            _thread = new Thread(MetricsSendingLoop);
            _thread.Start();

            var periodMs = int.Parse(_config.ConfigItems[Constants.Config_MetricMeasurmantPeriod]);

            _client = IpcConnector.Connect(_config);
            _timer  = new Timer(OnTimerTick, null, periodMs, periodMs);

            await MetricsMeasurmentLoop();
        }
Exemple #2
0
        public void Start(Configuration config)
        {
            _config        = config;
            _configManager = new ConfigurationManager();
            _configManager.Publish(config);

            _aggregator = new MetricAggregator();
            _aggregator.Start();

            _ipcServer = IpcConnector.GetServer(config);
            _ipcServer.OnMetricsHasArrived += OnMetricsHasArrived;
            _ipcServer.Start();
        }
Exemple #3
0
        private void StartConnecting(bool wait)
        {
            Debug.Assert(m_connect);

            //  Choose I/O thread to run connector in. Given that we are already
            //  running in an I/O thread, there must be at least one available.
            IOThread ioThread = ChooseIOThread(m_options.Affinity);

            Debug.Assert(ioThread != null);

            //  Create the connector object.

            if (m_addr.Protocol.Equals(Address.TcpProtocol))
            {
                var connector = new TcpConnector(ioThread, this, m_options, m_addr, wait);
                //alloc_Debug.Assert(connector);
                LaunchChild(connector);
                return;
            }

            if (m_addr.Protocol.Equals(Address.IpcProtocol))
            {
                var connector = new IpcConnector(ioThread, this, m_options, m_addr, wait);
                //alloc_Debug.Assert(connector);
                LaunchChild(connector);
                return;
            }

            if (m_addr.Protocol.Equals(Address.PgmProtocol) || m_addr.Protocol.Equals(Address.EpgmProtocol))
            {
                var pgmSender = new PgmSender(m_ioThread, m_options, m_addr);
                pgmSender.Init(m_addr.Resolved as PgmAddress);

                SendAttach(this, pgmSender);

                return;
            }

            Debug.Assert(false);
        }