Class ServerSubscriptionJournalStateStore
java.lang.Object
com.atlassian.confluence.internal.api.impl.service.incrementalsync.journal.ServerSubscriptionJournalStateStore
- All Implemented Interfaces:
JournalStateStore,SubscriptionJournalStateStore
- Direct Known Subclasses:
ClientSubscriptionJournalStateStore
public class ServerSubscriptionJournalStateStore
extends Object
implements SubscriptionJournalStateStore
A Journal State Store which will store the state based on Subscription Id
- Since:
- 9.3.0
-
Constructor Summary
ConstructorsConstructorDescriptionServerSubscriptionJournalStateStore(String subscriptionContextKey, IncrementalSyncSubscriptionManager incrementalSyncSubscriptionManager) -
Method Summary
Modifier and TypeMethodDescriptionvoidcleanUpSubscriptions(JournalIdentifier identifier, long ttlInMillis) A Utility which helps to clean up expired subscriptions and deleted subscriptioncreateNewSubscription(String subscriptionData) This method creates a new ACTIVE subscriptionvoiddeactivateSubscription(@NonNull JournalIdentifier journalId) Mark a subscription as deactivate so later onIncrementalSyncCleanerwill clean itGet all current subscriptionsGet all inactive subscriptionsprotected StringlonggetMostRecentId(@NonNull JournalIdentifier journalId) Returns the most recent id for a journal or 0 if no id has been stored yet.protected StringgetSubscriptionStateData(MultiSubscriptionPerJournalIdentifier subscriptionJournalIdentifier) Get subscription value detailbooleanisSubscriptionActive(MultiSubscriptionPerJournalIdentifier subscriptionJournalIdentifier) booleanremoveSubscriptionStateData(@NonNull JournalIdentifier journalId) Remove a particular subscription from data storevoidResets the state of all journals.protected SubscriptionIdvoidsetMostRecentId(@NonNull JournalIdentifier journalId, long id) Set the most recent identifier for a journal.
-
Constructor Details
-
ServerSubscriptionJournalStateStore
public ServerSubscriptionJournalStateStore(String subscriptionContextKey, IncrementalSyncSubscriptionManager incrementalSyncSubscriptionManager)
-
-
Method Details
-
getMostRecentId
public long getMostRecentId(@NonNull JournalIdentifier journalId) throws org.springframework.dao.DataAccessException Description copied from interface:JournalStateStoreReturns the most recent id for a journal or 0 if no id has been stored yet.New journal is automatically created if a journal with the given name does not exists.
- Specified by:
getMostRecentIdin interfaceJournalStateStore- Parameters:
journalId- id of the journal- Returns:
- most recent id for a journal or 0 if no id has been stored yet
- Throws:
org.springframework.dao.DataAccessException- if reading the id failed
-
setMostRecentId
public void setMostRecentId(@NonNull JournalIdentifier journalId, long id) throws org.springframework.dao.DataAccessException Description copied from interface:JournalStateStoreSet the most recent identifier for a journal.New journal is automatically created if a journal with the given name does not exists.
Only positive identifiers (e.g. > 0) can be stored.
- Specified by:
setMostRecentIdin interfaceJournalStateStore- Parameters:
journalId- id of the journalid- identifier to store as the most recent id- Throws:
org.springframework.dao.DataAccessException- if persisting the id failed.
-
saveSubscriptionStateData
-
resetAllJournalStates
public void resetAllJournalStates() throws org.springframework.dao.DataAccessExceptionDescription copied from interface:JournalStateStoreResets the state of all journals.After calling this method all
JournalStateStore.getMostRecentId(JournalIdentifier)calls will initially return 0.- Specified by:
resetAllJournalStatesin interfaceJournalStateStore- Throws:
org.springframework.dao.DataAccessException- if reset fails
-
deactivateSubscription
Description copied from interface:SubscriptionJournalStateStoreMark a subscription as deactivate so later onIncrementalSyncCleanerwill clean it- Specified by:
deactivateSubscriptionin interfaceSubscriptionJournalStateStore
-
removeSubscriptionStateData
public boolean removeSubscriptionStateData(@NonNull JournalIdentifier journalId) throws org.springframework.dao.DataAccessException Description copied from interface:SubscriptionJournalStateStoreRemove a particular subscription from data store- Specified by:
removeSubscriptionStateDatain interfaceSubscriptionJournalStateStore- Returns:
- Throws:
org.springframework.dao.DataAccessException
-
getAvailableSubscriptions
Description copied from interface:SubscriptionJournalStateStoreGet all current subscriptions- Specified by:
getAvailableSubscriptionsin interfaceSubscriptionJournalStateStore- Returns:
- list of current subscription ids
-
getDeactivateSubscriptions
Description copied from interface:SubscriptionJournalStateStoreGet all inactive subscriptions- Specified by:
getDeactivateSubscriptionsin interfaceSubscriptionJournalStateStore- Returns:
- list of inactive subscription ids
-
cleanUpSubscriptions
Description copied from interface:SubscriptionJournalStateStoreA Utility which helps to clean up expired subscriptions and deleted subscription- Specified by:
cleanUpSubscriptionsin interfaceSubscriptionJournalStateStore- Parameters:
identifier- an identifier for journal which manage all subscriptionttlInMillis- time to leave in milliseconds
-
createNewSubscription
Description copied from interface:SubscriptionJournalStateStoreThis method creates a new ACTIVE subscription- Specified by:
createNewSubscriptionin interfaceSubscriptionJournalStateStore- Parameters:
subscriptionData- the data associated with the subscription- Returns:
-
getSubscriptionContextKey
-
getKeyPrefix
-
getSubscriptionStateData
public Optional<IncrementalSyncSubscription> getSubscriptionStateData(MultiSubscriptionPerJournalIdentifier subscriptionJournalIdentifier) Description copied from interface:SubscriptionJournalStateStoreGet subscription value detail- Specified by:
getSubscriptionStateDatain interfaceSubscriptionJournalStateStore- Returns:
-
isSubscriptionActive
public boolean isSubscriptionActive(MultiSubscriptionPerJournalIdentifier subscriptionJournalIdentifier) - Specified by:
isSubscriptionActivein interfaceSubscriptionJournalStateStore- Parameters:
subscriptionJournalIdentifier- subscription identifier- Returns:
trueif the subscription is active
-