Interface IncrementalSyncService<S extends SubscriptionSpec,T extends IncrementalSyncModel>

Type Parameters:
T - Type of result
S - Specification how user want to subscribe data
All Known Subinterfaces:
ContentManagementIncrementalSyncService, GlobalPermissionManagementIncrementalSyncService, UserManagementIncrementalSyncService
All Known Implementing Classes:
AbstractIncrementalSyncService, ContentManagementIncrementalSyncServiceImpl, GlobalPermissionManagementIncrementalSyncServiceImpl, UserManagementIncrementalSyncServiceImpl

public interface IncrementalSyncService<S extends SubscriptionSpec,T extends IncrementalSyncModel>
Interface of incremental sync service
Since:
9.3.0
  • Method Details

    • subscribe

      SubscriptionId subscribe(S spec)
      Register to incremental api
      Parameters:
      spec - the specification
      Returns:
      an unique id
    • unsubscribe

      boolean unsubscribe(SubscriptionId subscriptionId)
      Remove an exising subscription
      Parameters:
      subscriptionId -
      Returns:
      indicate the operation is success or not
      Throws:
      NotFoundException - if the provided subscriptionId is not found or is inactive
    • processEvents

      IncrementalSyncPageResponse<T> processEvents(PageRequest pageRequest)
      Processing events
      Parameters:
      pageRequest - Page request with cursor.
      Returns:
      IncrementalSyncPageResponse which will contain the next cursor
    • getAvailableSubscriptions

      List<SubscriptionId> getAvailableSubscriptions()
      Get all subscription for current service
      Returns:
      list of available subscriptions
    • cleanUpSubscriptions

      void cleanUpSubscriptions()
      This will clean up inactive/unused subscription
    • isSubscriptionActive

      boolean isSubscriptionActive(long subscriptionId)
      Parameters:
      subscriptionId - the subscription id
      Returns:
      {code true} if the subscription is active
    • getMostRecentCursor

      IncrementalSyncCursor getMostRecentCursor(long id)
      This will find and return the most recent incremental sync cursor corresponding to the provided subscription's most recent journal entry, if one exists.
      Parameters:
      id - ID of the subscription.
      Returns:
      Optional incremental sync cursor pointing the latest journal entry.
      Throws:
      NotFoundException - when no active subscription with provided subscription ID found
    • handleEventForSubscription

      <E> void handleEventForSubscription(E event, Consumer<JournalIdentifier> processor)
      Based on input event this method will find a corresponding subscription which would like to handle it. Then will trigger the call back to handle that
      Type Parameters:
      E - an event
      Parameters:
      event -
      processor -
      Since:
      9.3.0
    • getEventsBatchLimit

      int getEventsBatchLimit()
      Get max size of the events batch, that can be handled by the incremental sync service
      Returns:
      max size of the events batch, that can be handled by the incremental sync service