public class InMemoryEventStore extends java.lang.Object implements EventStore
getEventsBatch(int),
 the chosen number of TrackerPayloads are removed from the queue. The batch is added to a map of payloads
 that are currently being sent, and wrapped as a BatchPayload. This BatchPayload wrapper is returned to the
 Emitter.
 If the POST request is successful, the payloads are deleted from the map.
 If not, they are removed from the map and reinserted into the queue to be sent again.| Constructor and Description | 
|---|
InMemoryEventStore()
Create a InMemoryEventStore object with default buffer size (10 000 events). 
 | 
InMemoryEventStore(int bufferCapacity)
Create a InMemoryEventStore object with custom queue capacity. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
boolean | 
addEvent(TrackerPayload trackerPayload)
Add TrackerPayload to buffer. 
 | 
java.util.List<TrackerPayload> | 
cleanupAfterSendingAttempt(boolean needRetry,
                          long batchId)
Finish processing events after a request has been made. 
 | 
java.util.List<TrackerPayload> | 
getAllEvents()
Get a copy of all the TrackerPayloads in the buffer. 
 | 
BatchPayload | 
getEventsBatch(int numberToGet)
Remove some TrackerPayloads from the buffer. 
 | 
int | 
size()
Get the current size of the buffer. 
 | 
public InMemoryEventStore(int bufferCapacity)
bufferCapacity - the maximum number of events to buffer at oncepublic InMemoryEventStore()
public boolean addEvent(TrackerPayload trackerPayload)
addEvent in interface EventStoretrackerPayload - the payload to addpublic BatchPayload getEventsBatch(int numberToGet)
getEventsBatch in interface EventStorenumberToGet - how many payloads to getpublic java.util.List<TrackerPayload> cleanupAfterSendingAttempt(boolean needRetry, long batchId)
cleanupAfterSendingAttempt in interface EventStoreneedRetry - if true, move events back to the buffer instead of deletingbatchId - the ID of the batch of eventspublic java.util.List<TrackerPayload> getAllEvents()
getAllEvents in interface EventStorepublic int size()
size in interface EventStore