Skip to content
This repository has been archived by the owner on Oct 21, 2023. It is now read-only.

Commit

Permalink
add HasSubscribers method to check if there are supscribers listening…
Browse files Browse the repository at this point in the history
… to given topic
  • Loading branch information
dtomasi committed Apr 2, 2021
1 parent cbc6cff commit 631d012
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions event_bus.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,3 +163,8 @@ func (eb *EventBus) SubscribeCallback(topic string, callable CallbackFunc) {
evt.Done()
}(callable)
}

// Check if a topic has subscribers
func (eb *EventBus) HasSubscribers(topic string) bool {
return len(eb.getSubscribingChannels(topic)) > 0
}

0 comments on commit 631d012

Please sign in to comment.