コード例 #1
0
 public SmartQueue(IUdpCommunication udpComm, IPersistenceLayer db, IJsonConfigurator jsonConfigurator, Topic topic)
 {
     _udpComm          = udpComm;
     _topic            = topic;
     _db               = db;
     _jsonConfigurator = jsonConfigurator;
     _db.EventAdded   += EventAdded;
     // Start Consuming messages if any
     if (_topic.Events.Count > 0)
     {
         EventAdded(this, EventArgs.Empty);
     }
 }
コード例 #2
0
        public AntiEntropy(IHarakaDb harakaDb, IMergeProcedure mergeProcedure, IJsonConfigurator jsonConfigurator)
        {
            _harakaDb         = harakaDb;
            _mergeProcedure   = mergeProcedure;
            _jsonConfigurator = jsonConfigurator;

            //Initialize all existing queues on startup
            foreach (var topic in _harakaDb.TryGetObjects <Topic>("Topics"))
            {
                var smartQueue = new SmartQueue(Setup.container.GetInstance <IUdpCommunication>(), Setup.container.GetInstance <IPersistenceLayer>(), Setup.container.GetInstance <IJsonConfigurator>(), topic);
                _queues.Add(smartQueue);
                smartQueue.SubscribersHasBeenUpdated += SmartQueueOnSubscribersHasBeenUpdated;
            }

            //Fetch all pub
            //Merge tentative
        }
コード例 #3
0
ファイル: PingPong.cs プロジェクト: CodeFork/HarakaMQ
        public PingPong(IUdpCommunication udpCommunication, ISchedular schedular, IAntiEntropy antiEntropy, IJsonConfigurator jsonConfigurator, IClock clock)
        {
            _schedular        = schedular;
            _antiEntropy      = antiEntropy;
            _jsonConfigurator = jsonConfigurator;
            _clock            = clock;
            _udpCommunication = udpCommunication;

            _latencyInMs = _jsonConfigurator.GetSettings().AntiEntropyMilliseonds / 10; //Todo: find real latency

            foreach (var broker in _jsonConfigurator.GetSettings().Brokers)
            {
                _brokers.Add(new BrokerInformation
                {
                    Active        = true,
                    PrimaryNumber = broker.PrimaryNumber,
                    Port          = broker.Port,
                    Ipadress      = broker.Ipadress
                });
            }
        }
コード例 #4
0
ファイル: NTP.cs プロジェクト: lanicon/HarakaMQ
 public NTP(IJsonConfigurator settings)
 {
     _serverAddress = settings.GetSettings().TimeSyncServerAddress;
 }