Class EventStoreDBPersistentSubscriptionsClient


  • public class EventStoreDBPersistentSubscriptionsClient
    extends java.lang.Object
    Represents EventStoreDB client for persistent subscriptions management. A client instance maintains a two-way communication to EventStoreDB. Many threads can use the EventStoreDB client simultaneously, or a single thread can make many asynchronous requests.
    • Method Detail

      • createToStream

        public java.util.concurrent.CompletableFuture createToStream​(java.lang.String stream,
                                                                     java.lang.String group)
        Creates a persistent subscription group on a stream.

        Persistent subscriptions are special kind of subscription where the server remembers the state of the subscription. This allows for many different modes of operations compared to a regular or catchup subscription where the client holds the subscription state. Persistent subscriptions don't guarantee ordering and unlike catchup-subscriptions, they start from the end of stream by default.

        Parameters:
        stream - stream's name.
        group - group's name
      • createToAll

        public java.util.concurrent.CompletableFuture createToAll​(java.lang.String group)
        Creates a persistent subscription group on the $all stream.

        Persistent subscriptions are special kind of subscription where the server remembers the state of the subscription. This allows for many different modes of operations compared to a regular or catchup subscription where the client holds the subscription state. Persistent subscriptions don't guarantee ordering and unlike catchup-subscriptions, they start from the end of stream by default.

        Parameters:
        group - group's name
      • createToStream

        public java.util.concurrent.CompletableFuture createToStream​(java.lang.String stream,
                                                                     java.lang.String group,
                                                                     CreatePersistentSubscriptionToStreamOptions options)
        Creates a persistent subscription group on a stream.

        Persistent subscriptions are special kind of subscription where the server remembers the state of the subscription. This allows for many different modes of operations compared to a regular or catchup subscription where the client holds the subscription state. Persistent subscriptions don't guarantee ordering and unlike catchup-subscriptions, they start from the end of stream by default.

        Parameters:
        stream - stream's name.
        group - group's name
        options - create persistent subscription request's options.
      • createToAll

        public java.util.concurrent.CompletableFuture createToAll​(java.lang.String group,
                                                                  CreatePersistentSubscriptionToAllOptions options)
        Creates a persistent subscription group on the $all stream.

        Persistent subscriptions are special kind of subscription where the server remembers the state of the subscription. This allows for many different modes of operations compared to a regular or catchup subscription where the client holds the subscription state. Persistent subscriptions don't guarantee ordering and unlike catchup-subscriptions, they start from the end of stream by default.

        Parameters:
        group - group's name
        options - create persistent subscription request's options.
      • updateToStream

        public java.util.concurrent.CompletableFuture updateToStream​(java.lang.String stream,
                                                                     java.lang.String group)
        Updates a persistent subscription group on a stream.
        Parameters:
        stream - stream's name.
        group - group's name.
      • updateToAll

        public java.util.concurrent.CompletableFuture updateToAll​(java.lang.String group)
        Updates a persistent subscription group on the $all stream.
        Parameters:
        group - group's name.
      • updateToStream

        public java.util.concurrent.CompletableFuture updateToStream​(java.lang.String stream,
                                                                     java.lang.String group,
                                                                     UpdatePersistentSubscriptionToStreamOptions options)
        Updates a persistent subscription group on a stream.
        Parameters:
        stream - stream's name.
        group - group's name.
        options - update persistent subscription request's options.
      • updateToAll

        public java.util.concurrent.CompletableFuture updateToAll​(java.lang.String group,
                                                                  UpdatePersistentSubscriptionToAllOptions options)
        Updates a persistent subscription group on the $all stream.
        Parameters:
        group - group's name.
        options - update persistent subscription request's options.
      • deleteToStream

        public java.util.concurrent.CompletableFuture deleteToStream​(java.lang.String stream,
                                                                     java.lang.String group)
        Deletes a persistent subscription group on a stream.
        Parameters:
        stream - stream's name.
        group - group's name.
      • deleteToAll

        public java.util.concurrent.CompletableFuture deleteToAll​(java.lang.String group)
        Deletes a persistent subscription group on the $all stream.
        Parameters:
        group - group's name.
      • deleteToStream

        public java.util.concurrent.CompletableFuture deleteToStream​(java.lang.String stream,
                                                                     java.lang.String group,
                                                                     DeletePersistentSubscriptionOptions options)
        Deletes a persistent subscription group on a stream.
        Parameters:
        stream - stream's name.
        group - group's name.
        options - the delete persistent subscription request's options.
      • deleteToAll

        public java.util.concurrent.CompletableFuture deleteToAll​(java.lang.String group,
                                                                  DeletePersistentSubscriptionOptions options)
        Deletes a persistent subscription group on the $all stream.
        Parameters:
        group - group's name.
        options - the delete persistent subscription request's options.
      • subscribeToStream

        public java.util.concurrent.CompletableFuture<PersistentSubscription> subscribeToStream​(java.lang.String stream,
                                                                                                java.lang.String group,
                                                                                                PersistentSubscriptionListener listener)
        Connects to a persistent subscription group on a stream.
        Parameters:
        stream - stream's name.
        group - group's name.
        listener - persistent subscription event listener.
        Returns:
        a persistent subscription handle.
      • subscribeToAll

        public java.util.concurrent.CompletableFuture<PersistentSubscription> subscribeToAll​(java.lang.String group,
                                                                                             PersistentSubscriptionListener listener)
        Connects to a persistent subscription group on the $all stream.
        Parameters:
        group - group's name.
        listener - persistent subscription event listener.
        Returns:
        a persistent subscription handle.
      • subscribeToStream

        public java.util.concurrent.CompletableFuture<PersistentSubscription> subscribeToStream​(java.lang.String stream,
                                                                                                java.lang.String group,
                                                                                                SubscribePersistentSubscriptionOptions options,
                                                                                                PersistentSubscriptionListener listener)
        Connects to a persistent subscription group on a stream.
        Parameters:
        stream - stream's name.
        group - group's name.
        options - a persistent subscription subscribe's request.
        listener - persistent subscription event listener.
        Returns:
        a persistent subscription handle.
      • subscribeToAll

        public java.util.concurrent.CompletableFuture<PersistentSubscription> subscribeToAll​(java.lang.String group,
                                                                                             SubscribePersistentSubscriptionOptions options,
                                                                                             PersistentSubscriptionListener listener)
        Connects to a persistent subscription group on the $all stream.
        Parameters:
        group - group's name.
        options - a persistent subscription subscribe's request.
        listener - persistent subscription event listener.
        Returns:
        a persistent subscription handle.
      • listToStream

        public java.util.concurrent.CompletableFuture<java.util.List<PersistentSubscriptionToStreamInfo>> listToStream​(java.lang.String stream,
                                                                                                                       ListPersistentSubscriptionsOptions options)
        Lists all persistent subscriptions of a specific stream.
        Parameters:
        stream - stream's name.
        options - list persistent subscriptions request's options.
      • getInfoToStream

        public java.util.concurrent.CompletableFuture<java.util.Optional<PersistentSubscriptionToStreamInfo>> getInfoToStream​(java.lang.String stream,
                                                                                                                              java.lang.String groupName)
        Gets a specific persistent subscription info to a stream.
        Parameters:
        stream - stream's name.
        groupName - group's name.
        See Also:
        PersistentSubscriptionInfo
      • replayParkedMessagesToStream

        public java.util.concurrent.CompletableFuture replayParkedMessagesToStream​(java.lang.String stream,
                                                                                   java.lang.String groupName,
                                                                                   ReplayParkedMessagesOptions options)
        Replays a persistent subscription to a stream parked events.
        Parameters:
        stream - stream's name.
        groupName - group's name.
        options - replay parked messages to stream request's options.
      • replayParkedMessagesToStream

        public java.util.concurrent.CompletableFuture replayParkedMessagesToStream​(java.lang.String stream,
                                                                                   java.lang.String groupName)
        Replays a persistent subscription to a stream parked events.
        Parameters:
        stream - stream's name.
        groupName - group's name.
      • replayParkedMessagesToAll

        public java.util.concurrent.CompletableFuture replayParkedMessagesToAll​(java.lang.String groupName,
                                                                                ReplayParkedMessagesOptions options)
        Replays a persistent subscription to the $all stream parked events.
        Parameters:
        groupName - group's name.
        options - replay parked messages to stream request's options.
      • replayParkedMessagesToAll

        public java.util.concurrent.CompletableFuture replayParkedMessagesToAll​(java.lang.String groupName)
                                                                         throws java.util.concurrent.ExecutionException,
                                                                                java.lang.InterruptedException
        Replays a persistent subscription to the $all stream parked events.
        Parameters:
        groupName - group's name.
        Throws:
        java.util.concurrent.ExecutionException
        java.lang.InterruptedException
      • restartSubsystem

        public java.util.concurrent.CompletableFuture restartSubsystem()
        Restarts the server persistent subscription subsystem.
      • restartSubsystem

        public java.util.concurrent.CompletableFuture restartSubsystem​(RestartPersistentSubscriptionSubsystemOptions options)
        Restarts the server persistent subscription subsystem.
        Parameters:
        options - restart persistent subscription subsystem request's options.
      • shutdown

        public java.util.concurrent.CompletableFuture<java.lang.Void> shutdown()
        Closes a connection and cleans all its allocated resources.
      • isShutdown

        public boolean isShutdown()
        Checks if this client instance has been shutdown. After shutdown a client instance can no longer process new operations and a new client instance has to be created.
        Returns:
        true if client instance has been shutdown.