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()
Returns a token that can be used for querying events that have happened
after the token was generated.
|
Events |
getNewEvents(String eventToken)
Returns an events object which contains a new eventToken and events that
happened after the given
eventToken was generated. |
void |
invalidateEvents()
Removes all events from the EventStore,
with no associated reason for the invalidation
|
void |
invalidateEvents(Class unsupportedEventSource)
Removes all events from the EventStore,
due to Crowd not supporting the specified event type.
|
void |
invalidateEvents(String reason)
Removes all events from the EventStore for the specified reason.
|
void |
storeEvent(OperationEvent event)
Stores the given event.
|
public EventStoreGeneric(long maxStoredEvents)
maxStoredEvents - maximum amount of events to keep in the memorypublic String getCurrentEventToken()
EventStoreIf 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 EventStorepublic Events getNewEvents(String eventToken) throws EventTokenExpiredException
EventStoreeventToken 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() again before asking for
new events.
getNewEvents in interface EventStoreeventToken - event token that was retrieved by a call to
EventStore.getCurrentEventToken() or EventStore.getNewEvents(String)eventToken was generated.EventTokenExpiredException - if events that happened after the
event token was generated can not be retrievedpublic void storeEvent(OperationEvent event)
EventStorestoreEvent in interface EventStoreevent - event to be storedpublic void invalidateEvents()
EventStoreinvalidateEvents in interface EventStorepublic void invalidateEvents(Class unsupportedEventSource)
EventStoreinvalidateEvents in interface EventStoreunsupportedEventSource - is used as the reason for the invalidation for logging purposes.public void invalidateEvents(String reason)
EventStoreinvalidateEvents in interface EventStorereason - is used for logging purposes.Copyright © 2016 Atlassian. All rights reserved.