Given an SQL table with timestamped records. Every once in a while an application App0
does something like foreach record in since(certainTimestamp) do process(record); commitOffset(record.timestamp)
, i.e. periodically it consumes a batch of "fresh" data, processes it sequentially and commits success after each record and then just sleeps for reasonable time (to accumulate yet another batch). That works perfect with single instance.. however how to load balance multiple ones?
In exactly the same environment App0
and App1
concurrently competite for the fresh data. The idea is that ready query executed by the App0
must not overlay with the same read query executed by the App1
- such that they never try to process the same item. In other words, I need SQL-based guarantees that concurrent read queries return different data. Is that even possible?
P.S. Postgres is preferred option.