Class DittoSyncSubscription
java.lang.Object
com.ditto.java.DittoSyncSubscription
- All Implemented Interfaces:
Closeable,AutoCloseable
A sync subscription configures
Ditto to receive updates from remote peers about documents
matching the subscription's query.
Create a sync subscription by calling DittoSync.registerSubscription(String). The subscription will
remain active until either explicitly cancelled via close() or the owning Ditto instance goes
out of scope.-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes the sync subscription so that new changes matching the query are no longer received from other peers.boolean@Nullable DittoCborSerializable.DictionaryReturns the query arguments of the sync subscription.@NonNull StringgetQuery()Returns the query string for this subscription.inthashCode()booleanisClosed()Returns whether the sync subscription has been closed.
-
Method Details
-
getQuery
Returns the query string for this subscription. Documents matching this query will be included in the subscription.- Returns:
- the query string.
-
getArguments
Returns the query arguments of the sync subscription. These are the arguments that were passed while registering the subscription.- Returns:
- the query arguments dictionary, or null if no arguments were provided.
-
isClosed
public boolean isClosed()Returns whether the sync subscription has been closed. Returnstrueif the sync subscription has been cancelled, otherwise returnsfalse. Also, a sync subscription is considered cancelled if the owningDittoinstance goes out of scope.- Returns:
- true if closed, false otherwise.
-
close
Closes the sync subscription so that new changes matching the query are no longer received from other peers. This is a no-op if the subscription is already closed via a previous call or the owningDittoinstance has gone out of scope.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException- if an I/O error occurs.
-
hashCode
-
equals
-