Interface SubscriptionStore


  • @DoNotImplement
    public interface SubscriptionStore
    This service allows extensions to manage the Subscriptions for client session programmatically.
    Since:
    4.0.0
    • Method Detail

      • addSubscription

        @NotNull java.util.concurrent.CompletableFuture<java.lang.Void> addSubscription​(@NotNull java.lang.String clientID,
                                                                                        @NotNull TopicSubscription subscription)
        This method adds a subscription for a certain client to a certain topic.

        CompletableFuture fails with a RateLimitExceededException if the extension service rate limit was exceeded.

        CompletableFuture fails with a DoNotImplementException if TopicSubscription is implemented by the extension.

        CompletableFuture fails with a NoSuchClientIdException if no session for this client exists.

        Parameters:
        clientID - The client for which the new subscription should be added.
        subscription - The subscription to which the client should be subscribed.
        Returns:
        A CompletableFuture object that will succeed, as soon as the subscription was added
        Throws:
        java.lang.NullPointerException - If clientID or subscription is null.
        java.lang.IllegalArgumentException - If clientID is empty.
        Since:
        4.0.0
      • addSubscriptions

        @NotNull java.util.concurrent.CompletableFuture<java.lang.Void> addSubscriptions​(@NotNull java.lang.String clientID,
                                                                                         @NotNull java.util.Set<TopicSubscription> subscriptions)
        This method adds multiple subscriptions for a certain client.

        CompletableFuture fails with a RateLimitExceededException if the extension service rate limit was exceeded.

        CompletableFuture fails with a DoNotImplementException if any of the TopicSubscription is implemented by the extension.

        CompletableFuture fails with a NoSuchClientIdException if no session for this client exists.

        Parameters:
        clientID - The client for which the new subscriptions should be added.
        subscriptions - The subscriptions to which the client should be subscribed.
        Returns:
        A CompletableFuture object that will succeed, as soon as the subscriptions were added.
        Throws:
        java.lang.NullPointerException - If clientID, subscriptions or one of the subscription in the set is null.
        java.lang.IllegalArgumentException - If clientID or subscriptions is empty.
        Since:
        4.0.0
      • removeSubscription

        @NotNull java.util.concurrent.CompletableFuture<java.lang.Void> removeSubscription​(@NotNull java.lang.String clientID,
                                                                                           @NotNull java.lang.String topicFilter)
        This method removes a subscription for a certain client and a certain topic.

        When the client or the subscription for the client does not exist, nothing happens.

        CompletableFuture fails with a RateLimitExceededException if the extension service rate limit was exceeded.

        CompletableFuture fails with a InvalidTopicException if the topic filter is invalid.

        Parameters:
        clientID - The client for which the subscription should be removed.
        topicFilter - The topic from which the client should get unsubscribed.
        Returns:
        A CompletableFuture object that will succeed, as soon as the subscription was removed.
        Throws:
        java.lang.NullPointerException - If clientID or topicFilter is null.
        java.lang.IllegalArgumentException - If clientID is empty.
        Since:
        4.0.0
      • removeSubscriptions

        @NotNull java.util.concurrent.CompletableFuture<java.lang.Void> removeSubscriptions​(@NotNull java.lang.String clientID,
                                                                                            @NotNull java.util.Set<java.lang.String> topicFilters)
        This method removes multiple subscriptions for a certain client.

        When the client does not exist, nothing happens. This also applies for subscriptions that should be removed for the client, but the client has no subscription for.

        CompletableFuture fails with a RateLimitExceededException if the extension service rate limit was exceeded.

        CompletableFuture fails with a InvalidTopicException if any topic filter is invalid.

        Parameters:
        clientID - The client for which the subscriptions should be removed.
        topicFilters - The topics from which the client should get unsubscribed.
        Returns:
        A CompletableFuture object that will succeed, as soon as the subscriptions were removed.
        Throws:
        java.lang.NullPointerException - If clientID, topics or one of the topics in the set is null.
        java.lang.IllegalArgumentException - If clientID or topics is empty.
        Since:
        4.0.0
      • getSubscriptions

        @NotNull java.util.concurrent.CompletableFuture<java.util.Set<TopicSubscription>> getSubscriptions​(@NotNull java.lang.String clientID)
        Returns all subscriptions a client is subscribed to.

        The returned Set is read-only and must not be modified. If the client does not exist, an empty Set is returned.

        CompletableFuture fails with a RateLimitExceededException if the extension service rate limit was exceeded.

        Parameters:
        clientID - The client from where to get all subscriptions.
        Returns:
        A CompletableFuture which contains all subscriptions the client subscribed to.
        Throws:
        java.lang.NullPointerException - If clientID is null.
        java.lang.IllegalArgumentException - If clientID is empty.
        Since:
        4.0.0