public bool RemoveMessage(string topic, string messageId) { TopicWiseBucketStatistics topicStats = _topicWiseMessageIds[topic] as TopicWiseBucketStatistics; if (topicStats != null) { int preUpdateSize = topicStats.InMemorySize; if (!topicStats.Remove(messageId)) { int postUpdateSize = topicStats.InMemorySize; if (preUpdateSize != postUpdateSize) { _size -= preUpdateSize - postUpdateSize; } } else { _topicWiseMessageIds.Remove(topic); _size -= preUpdateSize; return(true); } } return(false); }
public OrderedDictionary GetTopicWiseMessagIds(bool includeEventMessages) { OrderedDictionary topicWiseMessages = new OrderedDictionary(); foreach (string topic in _topicWiseMessageIds.Keys) { if (topic == null) { continue; } if (TopicConstant.AllEventTopics.Contains(topic) && !includeEventMessages) { continue; } TopicWiseBucketStatistics topicStats = _topicWiseMessageIds[topic] as TopicWiseBucketStatistics; if (topicStats != null) { topicWiseMessages.Add(topic, topicStats.GetMessageIds()); } } return(topicWiseMessages); }
public bool RemoveTopic(string topic) { TopicWiseBucketStatistics topicStats = _topicWiseMessageIds[topic] as TopicWiseBucketStatistics; if (topicStats != null) { _size -= topicStats.InMemorySize; _topicWiseMessageIds.Remove(topic); return(true); } return(false); }
public OrderedDictionary GetTopicWiseMessagIds() { OrderedDictionary topicWiseMessages = new OrderedDictionary(); foreach (string topic in _topicWiseMessageIds.Keys) { TopicWiseBucketStatistics topicStats = _topicWiseMessageIds[topic] as TopicWiseBucketStatistics; if (topicStats != null) { topicWiseMessages.Add(topic, topicStats.GetMessageIds()); } } return(topicWiseMessages); }
public void AddMessage(string topic, string messageId) { TopicWiseBucketStatistics topicStats = _topicWiseMessageIds[topic] as TopicWiseBucketStatistics; if (topicStats == null) { topicStats = new TopicWiseBucketStatistics(topic); _topicWiseMessageIds.Add(topic, topicStats); } int preUpdateSize = topicStats.InMemorySize; topicStats.AddMessage(messageId); int postUpdateSize = topicStats.InMemorySize; if (preUpdateSize != postUpdateSize) { _size += postUpdateSize - preUpdateSize; } }