Class OpenSearchJournalStateStore
java.lang.Object
com.atlassian.confluence.plugins.opensearch.OpenSearchJournalStateStore
- All Implemented Interfaces:
JournalStateStore
,ExportedJournalStateStore
ExportedJournalStateStore
which stores journal ids in OpenSearch- Since:
- 8.6
-
Nested Class Summary
-
Constructor Summary
ConstructorDescriptionOpenSearchJournalStateStore
(org.opensearch.client.opensearch.OpenSearchClient openSearchClient, OpenSearchConfig openSearchConfig, io.github.resilience4j.retry.RetryRegistry retryRegistry) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Creates journal index after store is createdlong
getMostRecentId
(@NonNull JournalIdentifier journalId) Returns the most recent id for a journal or 0 if no id has been stored yet.void
Resets the state of all journals.void
setMostRecentId
(@NonNull JournalIdentifier journalId, long id) Set the most recent identifier for a journal.
-
Constructor Details
-
OpenSearchJournalStateStore
public OpenSearchJournalStateStore(org.opensearch.client.opensearch.OpenSearchClient openSearchClient, OpenSearchConfig openSearchConfig, io.github.resilience4j.retry.RetryRegistry retryRegistry)
-
-
Method Details
-
createJournalIndex
Creates journal index after store is created- Throws:
IOException
- if the index creation fails
-
setMostRecentId
public void setMostRecentId(@NonNull JournalIdentifier journalId, long id) throws org.springframework.dao.DataAccessException Description copied from interface:JournalStateStore
Set 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:
setMostRecentId
in 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.
-
getMostRecentId
public long getMostRecentId(@NonNull JournalIdentifier journalId) throws org.springframework.dao.DataAccessException Description copied from interface:JournalStateStore
Returns 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:
getMostRecentId
in 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
-
resetAllJournalStates
public void resetAllJournalStates() throws org.springframework.dao.DataAccessExceptionDescription copied from interface:JournalStateStore
Resets the state of all journals.After calling this method all
JournalStateStore.getMostRecentId(JournalIdentifier)
calls will initially return 0.- Specified by:
resetAllJournalStates
in interfaceJournalStateStore
- Throws:
org.springframework.dao.DataAccessException
- if reset fails
-