Class DittoSync
java.lang.Object
com.ditto.java.DittoSync
-
Method Summary
Modifier and TypeMethodDescription@NonNull Set<? extends DittoSyncSubscription> Returns all currently active sync subscriptions.@NonNull DittoSyncSubscriptionregisterSubscription(@NonNull String query) Installs and returns a sync subscription for a query, configuring Ditto to receive updates from other peers for documents matching that query.@NonNull DittoSyncSubscriptionregisterSubscription(@NonNull String query, @Nullable DittoCborSerializable.Dictionary arguments) Installs and returns a sync subscription for a query, configuring Ditto to receive updates from other peers for documents matching that query.
-
Method Details
-
getSubscriptions
Returns all currently active sync subscriptions.- Returns:
- a
Setof activeDittoSyncSubscriptioninstances.
-
registerSubscription
public @NonNull DittoSyncSubscription registerSubscription(@NonNull String query) throws DittoException Installs and returns a sync subscription for a query, configuring Ditto to receive updates from other peers for documents matching that query. The givenquerymust be aSELECTquery, otherwise aDittoException.StoreExceptionwith store error reasonDittoException.StoreExceptionReason.QueryNotSupportedis thrown.- Parameters:
query- a string containing a valid query expressed in DQL.- Returns:
- an active
DittoSyncSubscriptionfor the givenquerythat can be used to close the subscription. Otherwise, the subscription will remain active until the owningDittoinstance goes out of scope. - Throws:
DittoException- if there is a problem creating or registering the subscription.- See Also:
-
registerSubscription
public @NonNull DittoSyncSubscription registerSubscription(@NonNull String query, @Nullable DittoCborSerializable.Dictionary arguments) throws DittoException Installs and returns a sync subscription for a query, configuring Ditto to receive updates from other peers for documents matching that query. The givenquerymust be aSELECTquery, otherwise aDittoException.StoreExceptionwith store error reasonDittoException.StoreExceptionReason.QueryNotSupportedis thrown.- Parameters:
query- a string containing a valid query expressed in DQL.arguments- an optional dictionary of values keyed by the placeholder name without the leading:. Example:["mileage": 123].- Returns:
- an active
DittoSyncSubscriptionfor the givenquerythat can be used to close the subscription. Otherwise, the subscription will remain active until the owningDittoinstance goes out of scope. - Throws:
DittoException- if there is a problem creating or registering the subscription.- See Also:
-