public void ReSend(Guid messageId) { var extendedPacketInformation = _harakaDb.TryGetObjects <ExtendedPacketInformation>(Setup.OutgoingMessagesCS).Find(x => x.Packet.Id == messageId); var sendMsg = new SenderMessage { Body = MessagePackSerializer.Serialize(extendedPacketInformation.Packet), Type = extendedPacketInformation.UdpMessageType }; _sender.SendMsg(sendMsg, extendedPacketInformation.Ip, extendedPacketInformation.Port); }
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 }
public void QueueDeclareMessageReceived(MessageReceivedEventArgs message) { var topics = _harakaDb.TryGetObjects <Topic>("Topics"); var topic = topics.Find(x => x.Name == message.AdministrationMessage.Topic); if (topic != null) { return; } lock (_harakaDb.GetLock("Topics")) { topics = _harakaDb.GetObjects <Topic>("Topics"); topic = new Topic(message.AdministrationMessage.Topic); topics.Add(topic); _harakaDb.StoreObject("Topics", topics); } var smartQueue = new SmartQueue(Setup.container.GetInstance <IUdpCommunication>(), Setup.container.GetInstance <IPersistenceLayer>(), Setup.container.GetInstance <IJsonConfigurator>(), topic); smartQueue.SubscribersHasBeenUpdated += SmartQueueOnSubscribersHasBeenUpdated; _queues.Add(smartQueue); }
public Event GetNextEvent(Topic topic) { return(_db.TryGetObjects <Topic>(_fileName).Find(x => x.Id == topic.Id).Events.FirstOrDefault()); }