Poll
Typically, the client polls the feeds periodically to process all entries that appear in a feed. The polling orchestration combines the techniques of navigating through feed pages and limiting the entries returned.
Follow these steps to ensure that the polling mechanism is reliable and the client processes the entries chronologically.
- Decide whether future-dated events should be processed after they become effective or immediately. The former approach requires implementation using the entries'
updated
date. The latter requires implementation using the entries'published
date attribute. The approach determines the filtering parameters (updated-min
orpublished-min
) and sorting parameter value (updated:asc
orpublished:asc
) to be used respectively. For more details about date effectivity in HCM Atom feeds, see Manage Date Effective Entries. - Read the feed by specifying the last processed timestamp from the previous poll.
- Gather new entries potentially going through all the pages, in a manner that is not impacted by entries published in between the calls.
- Process the entries by incrementing the last processed timestamp.
Here's a pseudo code which provides details of the polling pattern with future-dated events processed after they're effective.
pageSize = 10
page = 1
updatedMin = lastProcessedEntry (for the first time set to beginning of time)
repeat {
entries = GET /feed?updated-min=${updatedMin}&page-size=${pageSize}&page=${page}&orderBy=updated:asc
foreach entry : entries {
process entry
if (processed successfully) {
lastProcessedEntry = entry.updatedDate
}
else {
break repeat
}
}
page++
}
while (entries.size == pageSize)