public void SubScribeMessageReceived(MessageReceivedEventArgs message) { var subscriber = new Subscriber(message.IpAddress, message.Port, _jsonConfigurator.GetSettings().PrimaryNumber, message.SenderClient); _queues.Find(x => x.GetTopicId() == message.AdministrationMessage.Topic).AddEvent(new Event(subscriber, EventType.AddSubscriber)); _subscribers.Add(subscriber); }
private void PublishCommittedMessage(PublishPacketReceivedEventArgs message) { _topic.Subscribers = _db.GetSubScribers(_topic); foreach (var sub in _topic.Subscribers.Where(x => x.AttachedBroker == _jsonConfigurator.GetSettings().PrimaryNumber)) { _udpComm.SendPackage(message.Packet, sub.Ip, sub.Port); } }
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 }); } }
public void StartGossip() { _stopGossip = false; if (_jsonConfigurator.GetSettings().PrimaryNumber != 1) { return; } _clock.StartTimeSync(_brokers); _isPrimary = true; if (_jsonConfigurator.GetSettings().RunInClusterSetup) { StartGossiping(); } }
public NTP(IJsonConfigurator settings) { _serverAddress = settings.GetSettings().TimeSyncServerAddress; }