public final class EventStoreGeneric extends Object implements EventStore
EventStore
implementation that uses main memory as a
backing store. The amount of events stored is fixed, and after reaching the
limit, the oldest events will start to get dropped.Constructor and Description |
---|
EventStoreGeneric(long maxStoredEvents)
Creates a new EventStoreGeneric instance.
|
Modifier and Type | Method and Description |
---|---|
String |
getCurrentEventToken(List<Long> directoryIds)
Returns a token that can be used for querying events that have happened
after the token was generated.
|
Events |
getNewEvents(String eventToken,
List<Long> directoryIds)
Returns an events object which contains a new eventToken and events that
happened after the given
eventToken was generated. |
void |
handleApplicationEvent(Object event)
Notifies the store that an application event happened that might make it impossible to recreate the event
stream.
|
void |
storeOperationEvent(OperationEvent event)
Stores the given event.
|
public EventStoreGeneric(long maxStoredEvents)
maxStoredEvents
- maximum amount of events to keep in the memorypublic String getCurrentEventToken(List<Long> directoryIds)
EventStore
If the event token has not changed since the last call to this method, it is guaranteed that no new events have been received.
The format of event token is implementation specific and can change without a warning.
getCurrentEventToken
in interface EventStore
directoryIds
- the ids of directories that the token should include events forpublic Events getNewEvents(String eventToken, List<Long> directoryIds) throws EventTokenExpiredException
EventStore
eventToken
was generated.
If for any reason event store is unable to retrieve events that happened
after the event token was generated, an
EventTokenExpiredException
will be thrown. The caller is then
expected to call EventStore.getCurrentEventToken(List)
again before asking for
new events.
getNewEvents
in interface EventStore
eventToken
- event token that was retrieved by a call to
EventStore.getCurrentEventToken(List)
or EventStore.getNewEvents(String, List)
directoryIds
- the ids of directories to retrieve events foreventToken
was generated.EventTokenExpiredException
- if events that happened after the
event token was generated can not be retrievedpublic void storeOperationEvent(OperationEvent event)
EventStore
storeOperationEvent
in interface EventStore
event
- event to be storedpublic void handleApplicationEvent(Object event)
EventStore
handleApplicationEvent
in interface EventStore
event
- the atlassian-events event triggering the actionCopyright © 2018 Atlassian. All rights reserved.