Class EventStoreDBPersistentSubscriptionsClient
- java.lang.Object
-
- com.eventstore.dbclient.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 Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static EventStoreDBPersistentSubscriptionsClient
create(EventStoreDBClientSettings settings)
Creates a persistent subscription client instance.java.util.concurrent.CompletableFuture
createToAll(java.lang.String group)
Creates a persistent subscription group on the $all stream.java.util.concurrent.CompletableFuture
createToAll(java.lang.String group, CreatePersistentSubscriptionToAllOptions options)
Creates a persistent subscription group on the $all stream.java.util.concurrent.CompletableFuture
createToStream(java.lang.String stream, java.lang.String group)
Creates a persistent subscription group on a stream.java.util.concurrent.CompletableFuture
createToStream(java.lang.String stream, java.lang.String group, CreatePersistentSubscriptionToStreamOptions options)
Creates a persistent subscription group on a stream.java.util.concurrent.CompletableFuture
deleteToAll(java.lang.String group)
Deletes a persistent subscription group on the $all stream.java.util.concurrent.CompletableFuture
deleteToAll(java.lang.String group, DeletePersistentSubscriptionOptions options)
Deletes a persistent subscription group on the $all stream.java.util.concurrent.CompletableFuture
deleteToStream(java.lang.String stream, java.lang.String group)
Deletes a persistent subscription group on a stream.java.util.concurrent.CompletableFuture
deleteToStream(java.lang.String stream, java.lang.String group, DeletePersistentSubscriptionOptions options)
Deletes a persistent subscription group on a stream.static EventStoreDBPersistentSubscriptionsClient
from(EventStoreDBClientBase existingClient)
Returns a Persistent Subscription Management client based on existing client.java.util.concurrent.CompletableFuture<java.util.Optional<PersistentSubscriptionToAllInfo>>
getInfoToAll(java.lang.String groupName)
Gets a specific persistent subscription info to the $all stream.java.util.concurrent.CompletableFuture<java.util.Optional<PersistentSubscriptionToAllInfo>>
getInfoToAll(java.lang.String groupName, GetPersistentSubscriptionInfoOptions options)
Gets a specific persistent subscription info to the $all stream.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.java.util.concurrent.CompletableFuture<java.util.Optional<PersistentSubscriptionToStreamInfo>>
getInfoToStream(java.lang.String stream, java.lang.String groupName, GetPersistentSubscriptionInfoOptions options)
Gets a specific persistent subscription info.boolean
isShutdown()
Checks if this client instance has been shutdown.java.util.concurrent.CompletableFuture<java.util.List<PersistentSubscriptionInfo>>
listAll()
Lists all existing persistent subscriptions.java.util.concurrent.CompletableFuture<java.util.List<PersistentSubscriptionInfo>>
listAll(ListPersistentSubscriptionsOptions options)
Lists all existing persistent subscriptions.java.util.concurrent.CompletableFuture<java.util.List<PersistentSubscriptionToAllInfo>>
listToAll()
Lists all persistent subscriptions of a specific to the $all stream.java.util.concurrent.CompletableFuture<java.util.List<PersistentSubscriptionToAllInfo>>
listToAll(ListPersistentSubscriptionsOptions options)
Lists all persistent subscriptions of a specific to the $all stream.java.util.concurrent.CompletableFuture<java.util.List<PersistentSubscriptionToStreamInfo>>
listToStream(java.lang.String stream)
Lists all persistent subscriptions of a specific stream.java.util.concurrent.CompletableFuture<java.util.List<PersistentSubscriptionToStreamInfo>>
listToStream(java.lang.String stream, ListPersistentSubscriptionsOptions options)
Lists all persistent subscriptions of a specific stream.java.util.concurrent.CompletableFuture
replayParkedMessagesToAll(java.lang.String groupName)
Replays a persistent subscription to the $all stream parked events.java.util.concurrent.CompletableFuture
replayParkedMessagesToAll(java.lang.String groupName, ReplayParkedMessagesOptions options)
Replays a persistent subscription to the $all stream parked events.java.util.concurrent.CompletableFuture
replayParkedMessagesToStream(java.lang.String stream, java.lang.String groupName)
Replays a persistent subscription to a stream parked events.java.util.concurrent.CompletableFuture
replayParkedMessagesToStream(java.lang.String stream, java.lang.String groupName, ReplayParkedMessagesOptions options)
Replays a persistent subscription to a stream parked events.java.util.concurrent.CompletableFuture
restartSubsystem()
Restarts the server persistent subscription subsystem.java.util.concurrent.CompletableFuture
restartSubsystem(RestartPersistentSubscriptionSubsystemOptions options)
Restarts the server persistent subscription subsystem.java.util.concurrent.CompletableFuture<java.lang.Void>
shutdown()
Closes a connection and cleans all its allocated resources.java.util.concurrent.CompletableFuture<PersistentSubscription>
subscribeToAll(java.lang.String group, PersistentSubscriptionListener listener)
Connects to a persistent subscription group on the $all stream.java.util.concurrent.CompletableFuture<PersistentSubscription>
subscribeToAll(java.lang.String group, SubscribePersistentSubscriptionOptions options, PersistentSubscriptionListener listener)
Connects to a persistent subscription group on the $all stream.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.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.java.util.concurrent.CompletableFuture
updateToAll(java.lang.String group)
Updates a persistent subscription group on the $all stream.java.util.concurrent.CompletableFuture
updateToAll(java.lang.String group, UpdatePersistentSubscriptionToAllOptions options)
Updates a persistent subscription group on the $all stream.java.util.concurrent.CompletableFuture
updateToStream(java.lang.String stream, java.lang.String group)
Updates a persistent subscription group on a stream.java.util.concurrent.CompletableFuture
updateToStream(java.lang.String stream, java.lang.String group, UpdatePersistentSubscriptionToStreamOptions options)
Updates a persistent subscription group on a stream.
-
-
-
Method Detail
-
create
public static EventStoreDBPersistentSubscriptionsClient create(EventStoreDBClientSettings settings)
Creates a persistent subscription client instance.
-
from
public static EventStoreDBPersistentSubscriptionsClient from(EventStoreDBClientBase existingClient)
Returns a Persistent Subscription Management client based on existing client.- Parameters:
existingClient
- Existing client.
-
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 nameoptions
- 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 nameoptions
- 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.
-
listAll
public java.util.concurrent.CompletableFuture<java.util.List<PersistentSubscriptionInfo>> listAll(ListPersistentSubscriptionsOptions options)
Lists all existing persistent subscriptions.- Parameters:
options
- list persistent subscriptions request's options.- See Also:
PersistentSubscriptionInfo
-
listAll
public java.util.concurrent.CompletableFuture<java.util.List<PersistentSubscriptionInfo>> listAll()
Lists all existing persistent subscriptions.- See Also:
PersistentSubscriptionInfo
-
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.
-
listToStream
public java.util.concurrent.CompletableFuture<java.util.List<PersistentSubscriptionToStreamInfo>> listToStream(java.lang.String stream)
Lists all persistent subscriptions of a specific stream.- Parameters:
stream
- stream's name.- See Also:
PersistentSubscriptionToStreamInfo
-
listToAll
public java.util.concurrent.CompletableFuture<java.util.List<PersistentSubscriptionToAllInfo>> listToAll()
Lists all persistent subscriptions of a specific to the $all stream.- See Also:
PersistentSubscriptionToAllInfo
-
listToAll
public java.util.concurrent.CompletableFuture<java.util.List<PersistentSubscriptionToAllInfo>> listToAll(ListPersistentSubscriptionsOptions options)
Lists all persistent subscriptions of a specific to the $all stream.- Parameters:
options
- list persistent subscriptions request's options.- See Also:
PersistentSubscriptionToAllInfo
-
getInfoToStream
public java.util.concurrent.CompletableFuture<java.util.Optional<PersistentSubscriptionToStreamInfo>> getInfoToStream(java.lang.String stream, java.lang.String groupName, GetPersistentSubscriptionInfoOptions options)
Gets a specific persistent subscription info.- Parameters:
stream
- stream's name.groupName
- group's name.options
- get persistent subscription info request's options.- See Also:
PersistentSubscriptionInfo
-
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
-
getInfoToAll
public java.util.concurrent.CompletableFuture<java.util.Optional<PersistentSubscriptionToAllInfo>> getInfoToAll(java.lang.String groupName, GetPersistentSubscriptionInfoOptions options)
Gets a specific persistent subscription info to the $all stream.- Parameters:
groupName
- group's name.options
- get persistent subscription info request's options.- See Also:
PersistentSubscriptionToAllInfo
-
getInfoToAll
public java.util.concurrent.CompletableFuture<java.util.Optional<PersistentSubscriptionToAllInfo>> getInfoToAll(java.lang.String groupName)
Gets a specific persistent subscription info to the $all stream.- Parameters:
groupName
- group's name.- See Also:
PersistentSubscriptionToAllInfo
-
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.
-
-