Get topic stats.
(&self, topic_name: &str)
| 331 | |
| 332 | /// Get topic stats. |
| 333 | pub fn topic_stats(&self, topic_name: &str) -> Option<TopicStats> { |
| 334 | let topics = super::lock_utils::read_or_recover(self.topics.read(), "topics"); |
| 335 | let topic_mutex = topics.get(topic_name)?; |
| 336 | let topic = super::lock_utils::lock_or_recover(topic_mutex.lock(), "topic"); |
| 337 | Some(TopicStats { |
| 338 | name: topic_name.to_string(), |
| 339 | message_count: topic.messages.len(), |
| 340 | subscriber_count: topic.subscribers.len(), |
| 341 | consumer_group_count: topic.consumer_groups.len(), |
| 342 | next_seq: topic.next_seq, |
| 343 | }) |
| 344 | } |
| 345 | } |
| 346 | |
| 347 | /// Topic statistics. |