Class SubscriptionRegistry

java.lang.Object
ch.rasc.wamp2spring.pubsub.SubscriptionRegistry

public class SubscriptionRegistry extends Object
In memory subscription registry
  • Constructor Details

    • SubscriptionRegistry

      public SubscriptionRegistry()
  • Method Details

    • listSubscriptions

      public EnumMap<MatchPolicy,List<Long>> listSubscriptions()
      Returns subscription IDs listed according to matching policies.
      Returns:
      subscription IDs grouped by matching policies
    • lookupSubscription

      @Nullable public Long lookupSubscription(String topic, @Nullable MatchPolicy matchPolicy)
      Returns the subscription ID (if any) managing a topic, according to the matching policy.
      Parameters:
      topic - the topic URI
      matchPolicy - the matching policy
      Returns:
      the subscription id or null if no matching subscription exist
    • getMatchSubscriptions

      public List<Long> getMatchSubscriptions(String topic)
      Returns a list of IDs of subscriptions matching a topic URI, irrespective of match policy.
      Parameters:
      topic - the topic URI
      Returns:
      the list of session IDs subscribed to the topic
    • getSubscription

      @Nullable public SubscriptionDetail getSubscription(long subscriptionId)
      Returns information on a particular subscription.
      Parameters:
      subscriptionId - the id of the subscription
      Returns:
      the detail about the requested subscription. null when the subscription does not exist.
    • listSubscribers

      public List<Long> listSubscribers(long subscriptionId)
      Returns a list of session IDs for sessions currently attached to the subscription.
      Parameters:
      subscriptionId - the id of the subscription
      Returns:
      the list of session IDs attached to the subscription
    • countSubscribers

      @Nullable public Integer countSubscribers(long subscriptionId)
      Returns the number of sessions currently attached to the subscription.
      Parameters:
      subscriptionId - the subscription id
      Returns:
      the number of subscriptions or null when the subscription does not exist.
    • hasSubscribers

      public boolean hasSubscribers(String topic)
      Checks if a particular topic currently has attached subscriptions
      Parameters:
      topic - the topic
      Returns:
      true if currently sessions are attached to the topic