Interface SubscriptionRegistry

All Known Implementing Classes:
DefaultSubscriptionRegistry

public interface SubscriptionRegistry
  • Method Details

    • subscribe

      void subscribe(String clientId, String event)
    • unsubscribe

      void unsubscribe(String clientId, String event)
    • isClientSubscribedToEvent

      boolean isClientSubscribedToEvent(String clientId, String eventName)
    • getAllEvents

      Set<String> getAllEvents()
      Get a collection of all registered events
      Returns:
      an unmodifiable set of all events
    • getAllSubscriptions

      Map<String,Set<String>> getAllSubscriptions()
      Get a map that maps events to a collection of clientIds
      Returns:
      map with the event as key, the value is a set of clientIds
    • getSubscribers

      Set<String> getSubscribers(String event)
      Get all subscribers to a particular event
      Returns:
      an unmodifiable set of all subscribed clientIds to this event. Empty when nobody is subscribed
    • countSubscribers

      int countSubscribers(String event)
      Get the number of subscribers to a particular event
      Returns:
      the number of clientIds subscribed to this event. 0 when nobody is subscribed
    • hasSubscribers

      boolean hasSubscribers(String event)
      Check if a particular event has subscribers
      Returns:
      true when the event has 1 or more subscribers.