Data Subscriptions: Maintenance Operations



Deletion

Subscriptions can be entirely deleted from the system.

This operation can be very useful in ad-hoc subscription scenarios when a lot of subscriptions tasks information may accumulate, making tasks management very hard.

void delete(String name);

void delete(String name, String database);

usage:

store.subscriptions().delete(subscriptionName);

Dropping connection

Subscription connections with workers can be dropped remotely.
A dropped worker will not try to reconnect to the server.

void dropConnection(String name);

void dropConnection(String name, String database);

usage:

store.subscriptions().dropConnection(subscriptionName);

Disabling subscription

Information

This operation can only be performed through the management studio

Updating subscription

Information

This operation can only be performed through the management studio

Getting subscription status

SubscriptionState getSubscriptionState(String subscriptionName);

SubscriptionState getSubscriptionState(String subscriptionName, String database);

usage:

SubscriptionState subscriptionState = store.subscriptions().getSubscriptionState(subscriptionName);

SubscriptionState

Member Type Description
query String Subscription's RQL like query.
lastBatchAckTime Date Last time a batch processing progress was acknowledged.
nodeTag String Processing server's node tag
mentorNode String The mentor node that was manually set.
subscriptionName String Subscription's name, and also it's unique identifier
subscriptionId long Subscription's internal identifier (cluster's operation etag during subscription creation)
changeVectorForNextBatchStartingPoint String Change vector, starting from which the subscription will send documents. This value is updated manually, or automatically on batch acknowledgment
disabled boolean If true, subscription will not allow workers to connect
lastClientConnectionTime Date Time when last client was connected (value sustained after disconnection)

DocumentSubscriptions class

The DocumentSubscriptions class is the class that manages all interaction with the data subscriptions. The class is available through DocumentStore's subscriptions() method.
Method Signature Return type Description
create(SubscriptionCreationOptions options) String Creates a new data subscription.
create(SubscriptionCreationOptions options, String database) String Creates a new data subscription.
create(SubscriptionCreationOptions options) String Creates a new data subscription.
create(Class clazz) String Creates a new data subscription.
create(Class clazz, SubscriptionCreationOptions options) String Creates a new data subscription.
create(Class clazz, SubscriptionCreationOptions options, String database) String Creates a new data subscription.
createForRevisions(Class clazz) String Creates a new data subscription.
createForRevisions(Class clazz, SubscriptionCreationOptions options) String Creates a new data subscription.
createForRevisions(Class clazz, SubscriptionCreationOptions options, String database) String Creates a new data subscription.
delete(String name) void Deletes subscription.
delete(String name, String database) void Deletes subscription.
dropConnection(String name) void Drops existing subscription connection with worker.
dropConnection(String name, String database) void Drops existing subscription connection with worker.
getSubscriptions(int start, int take) List<SubscriptionState> Returns subscriptions list.
getSubscriptions(int start, int take, String database) List<SubscriptionState> Returns subscriptions list.
getSubscriptionState(String subscriptionName) SubscriptionState Get specific subscription state.
getSubscriptionState(String subscriptionName, String database) SubscriptionState Get specific subscription state.
getSubscriptionWorker(string subscriptionName) SubscriptionWorker<ObjectNode> Generates a subscription worker, using default configurations, that processes documents in it's raw ObjectNode type .
getSubscriptionWorker(string subscriptionName, String database) SubscriptionWorker<ObjectNode> Generates a subscription worker, using default configurations, that processes documents in it's raw ObjectNode type .
getSubscriptionWorker(SubscriptionWorkerOptions options) SubscriptionWorker<ObjectNode> Generates a subscription worker, using default configurations, that processes documents in it's raw ObjectNode type .
getSubscriptionWorker(SubscriptionWorkerOptions options, String database) SubscriptionWorker<ObjectNode> Generates a subscription worker, using default configurations, that processes documents in it's raw ObjectNode type .
getSubscriptionWorker(Class clazz, String subscriptionName) SubscriptionWorker<T> Generates a subscription worker, using default configurations, that processes documents deserialized to T type .
getSubscriptionWorker(Class clazz, String subscriptionName, String database) SubscriptionWorker<T> Generates a subscription worker, using default configurations, that processes documents deserialized to T type .
getSubscriptionWorker(Class clazz, SubscriptionWorkerOptions options) SubscriptionWorker<T> Generates a subscription worker, using provided configuration, that processes documents deserialized to T type .
getSubscriptionWorker(Class clazz, SubscriptionWorkerOptions options, String database) SubscriptionWorker<T> Generates a subscription worker, using provided configuration, that processes documents deserialized to T type .
getSubscriptionWorkerForRevisions(Class clazz, String subscriptionName) SubscriptionWorker<Revision<T>> Generates a subscription worker, using default configurations, that processes documents deserialized to T type .
getSubscriptionWorkerForRevisions(Class clazz, String subscriptionName, String database) SubscriptionWorker<Revision<T>> Generates a subscription worker, using default configurations, that processes documents deserialized to T type .
getSubscriptionWorkerForRevisions(Class clazz, SubscriptionWorkerOptions options) SubscriptionWorker<Revision<T>> Generates a subscription worker, using provided configuration, that processes documents deserialized to T type .
getSubscriptionWorkerForRevisions(Class clazz, SubscriptionWorkerOptions options, String database) SubscriptionWorker<Revision<T>> Generates a subscription worker, using provided configuration, that processes documents deserialized to T type .