public interface ResourceEventStore extends Store
ResourceEvent
s.
This store is to be used by listeners registered in the application to report change events as they occur.
An event store instance is to retrieve with TrsStoreSynchronizer.getResourceEventStore()
,
which ensures method calls are correctly synchronized across the whole web application.TrsStoreSynchronizer.getResourceEventStore()
Modifier and Type | Method and Description |
---|---|
void |
store(Function<Consumer<ResourceEvent>,?> eventsProvider)
Stores
resource events . |
void |
store(ResourceEvent... resourceEvents)
Stores one or a few
resource events . |
corrupt, isCorrupted
void store(ResourceEvent... resourceEvents)
resource events
.
If a larger volume of events is to send at once, client is recommended to rather use the store(Function)
method.
Implementations must not store events if base is not computed
and must assign properly the
event order
before saving (resourceEvents
must be provided chronologically sorted as they
occurred).
This method is intended to avoid raising TrsStoreException
, if something went wrong preventing the storage of the event,
implementations must corrupt
the storage silently.
resourceEvents
- events to store.void store(Function<Consumer<ResourceEvent>,?> eventsProvider)
resource events
.
If only one or a few events are to report at once, client may use the simpler store(ResourceEvent...)
method.
The function implementation must be thread-safe, as the store will call the Function.apply(Object)
method in a dedicated thread,
so that calls to this method are non blocking.
Implementations must not store events if base is not computed
and must assign properly the
event order
before saving (resourceEvents
must be provided chronologically sorted as they
occurred).
This method is intended to avoid raising TrsStoreException
, if something went wrong preventing the storage of the event,
implementations must corrupt
the storage silently.
The function argument provides access to change events to be added in this store.
Implementation must call the apply()
method of this function and use as argument a Consumer
to get notified of events.
Implementation is advised to use a BufferedConsumer
for optimal performance.
eventsProvider
- a function that provides access to change events to become part of the trs:ChangeLog
.BufferedConsumer
,
store(ResourceEvent...)