Interface IncrementalSyncService<S extends SubscriptionSpec,T extends IncrementalSyncModel>
- Type Parameters:
T
- Type of resultS
- 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 Summary
Modifier and TypeMethodDescriptionvoid
This will clean up inactive/unused subscriptionGet all subscription for current serviceint
Get max size of the events batch, that can be handled by the incremental sync servicegetMostRecentCursor
(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.<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.boolean
isSubscriptionActive
(long subscriptionId) processEvents
(PageRequest pageRequest) Processing eventsRegister to incremental apiboolean
unsubscribe
(SubscriptionId subscriptionId) Remove an exising subscription
-
Method Details
-
subscribe
Register to incremental api- Parameters:
spec
- the specification- Returns:
- an unique id
-
unsubscribe
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
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
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
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
-