Interface JournalService
-
public interface JournalService
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
JournalService.Builder
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static JournalService.Builder
builder()
JournalEntry
get(String linkUrl)
JournalEntry
getLatest()
JournalEntry
getOldest()
JournalEntry
getSince(String position)
JournalEntry
getSince(String position, int maxBatchSize)
-
-
-
Method Detail
-
getOldest
JournalEntry getOldest()
- Returns:
- the oldest the oldest events in the journal. However, because older events expire after
7 days, the best the API can do is to return the oldest available events in the journal.
Hence, over time the response of the Journaling API when called without any query parameters will change. This is only because as older events expire, the starting position of the journal begins pointing to a new set of oldest available events.
-
getLatest
JournalEntry getLatest()
- Returns:
- the latest journal Entry: in most cases, there will not be any events to consume yet
In an extremely rare case, there might actually be events that were written in near-real time to the journal after the request was made
This method is just a way to jump to the "end" of the journal (asking for "events from now onward"). The client applications should use the Entry.getNextLink() to iterate over the journal from that position onward.
- See Also:
JournalEntry.getNextLink()
-
getSince
JournalEntry getSince(String position)
- Parameters:
position
- the last event position you already read. Once the events at a certain position have expired, that position in the journal can no longer be used to fetch more events. In such a scenario, your application will need to reset its position in the journal. To reset the position you could chose to consume events from the oldest available position or the latest position depending on your use case.- Returns:
- the next journal Entry available after the provided position. Note that instead of constructing the URL to the next batch of "newer" events it is strongly recommended that you utilize the nextLink provided in any previous Entry you already fetched.
- See Also:
JournalEntry.getNextLink()
-
getSince
JournalEntry getSince(String position, int maxBatchSize)
- Parameters:
position
- the last event position you already read. Once the events at a certain position have expired, that position in the journal can no longer be used to fetch more events. In such a scenario, your application will need to reset its position in the journal. To reset the position you could chose to consume events from the oldest available position or the latest position depending on your use case.maxBatchSize
- When events are created at a high frequency, Journal persists groups of events in its storage units; when events are created at a lower rate, these storage units will contain only one event.Hence, depending on the traffic of the events associated with your registration, the number of events returned in a single response batch varies: a batch of events contains at least one event (if you are not already at the end of the journal), but there is no pre-defined upper limit.
In case you wish to set an upper bound, you can supply this maxBatchSize with the maximum number of events that may be returned by the API.
- Returns:
- the next journal Entry available after the provided position (filled with maximum maxBatchSize events). Note that instead of constructing the URL to the next batch of "newer" events it is strongly recommended that you utilize the nextLink provided in any previous Entry you already fetched.
- See Also:
JournalEntry.getNextLink()
-
get
JournalEntry get(String linkUrl)
- Parameters:
linkUrl
- typically the nextLink provided in any previous Entry you already fetched.- Returns:
- get a Journal Entry using a linkUrl
- See Also:
JournalEntry.getNextLink()
-
builder
static JournalService.Builder builder()
-
-