Class TimestampBasedEventStore
- All Implemented Interfaces:
EventStore
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionTimestampBasedEventStore
(UserDao userDao, TombstoneDao tombstoneDao, GroupDao groupDao, InternalMembershipDao membershipDao, int eventCountLimit) TimestampBasedEventStore
(UserDao userDao, GroupDao groupDao, InternalMembershipDao membershipDao, TombstoneDao tombstoneDao, Clock clock, int eventCountLimit) -
Method Summary
Modifier and TypeMethodDescriptiongetCurrentEventToken
(List<Long> directoryIds) Returns a token that can be used for querying events that have happened after the token was generated.getNewEvents
(String eventToken, Application application) Returns an events object which contains a new eventToken and events that happened after the giveneventToken
was generated.getNewEvents
(String eventToken, List<Long> directoryIds) Returns an events object which contains a new eventToken and events that happened after the giveneventToken
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
Stores the given event.
-
Field Details
-
TIMESTAMP_SLOP_TOLERANCE
public static final long TIMESTAMP_SLOP_TOLERANCE
-
-
Constructor Details
-
TimestampBasedEventStore
public TimestampBasedEventStore(UserDao userDao, TombstoneDao tombstoneDao, GroupDao groupDao, InternalMembershipDao membershipDao, int eventCountLimit) -
TimestampBasedEventStore
public TimestampBasedEventStore(UserDao userDao, GroupDao groupDao, InternalMembershipDao membershipDao, TombstoneDao tombstoneDao, Clock clock, int eventCountLimit)
-
-
Method Details
-
getCurrentEventToken
Description copied from interface:EventStore
Returns a token that can be used for querying events that have happened after the token was generated.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.
- Specified by:
getCurrentEventToken
in interfaceEventStore
- Parameters:
directoryIds
- the ids of directories that the token should include events for- Returns:
- token that can be used for querying events that have happened after the token was generated.
-
getNewEvents
@Transactional public Events getNewEvents(String eventToken, List<Long> directoryIds) throws EventTokenExpiredException Description copied from interface:EventStore
Returns an events object which contains a new eventToken and events that happened after the giveneventToken
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 callEventStore.getCurrentEventToken(List)
again before asking for new events.- Specified by:
getNewEvents
in interfaceEventStore
- Parameters:
eventToken
- event token that was retrieved by a call toEventStore.getCurrentEventToken(List)
orEventStore.getNewEvents(String, List)
directoryIds
- the ids of directories to retrieve events for- Returns:
- events object which contains a new eventToken and events that
happened after the given
eventToken
was generated. - Throws:
EventTokenExpiredException
- if events that happened after the event token was generated can not be retrieved
-
getNewEvents
@Transactional public Events getNewEvents(String eventToken, Application application) throws EventTokenExpiredException Description copied from interface:EventStore
Returns an events object which contains a new eventToken and events that happened after the giveneventToken
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 callEventStore.getCurrentEventToken(List)
again before asking for new events.- Specified by:
getNewEvents
in interfaceEventStore
- Parameters:
eventToken
- event token that was retrieved by a call toEventStore.getCurrentEventToken(List)
orEventStore.getNewEvents(String, List)
application
- the application to retrieve events for- Returns:
- events object which contains a new eventToken and events that
happened after the given
eventToken
was generated. - Throws:
EventTokenExpiredException
- if events that happened after the event token was generated can not be retrieved
-
storeOperationEvent
Description copied from interface:EventStore
Stores the given event. Implementations MIGHT limit the amount of events stored, and MIGHT not store the event at all if it can be recreated by other means.- Specified by:
storeOperationEvent
in interfaceEventStore
- Parameters:
event
- event to be stored
-
handleApplicationEvent
Description copied from interface:EventStore
Notifies the store that an application event happened that might make it impossible to recreate the event stream. Depending on the implementation the store MIGHT remove all relevant events, or mark them as invalid. After the call the store MUST NOT present an event stream that might not be valid as a result of the event.- Specified by:
handleApplicationEvent
in interfaceEventStore
- Parameters:
event
- the atlassian-events event triggering the action
-