MessageDecoder decodes raw bytes to Message It is usually written by end user and passed into TimeReplayableSource
filter offsets and store the mapping from timestamp to offset
manages message's offset on TimeReplayableSource and timestamp
OffsetStorage stores the mapping from TimeStamp to Offset
resolve timestamp to offset by look up the underlying storage
TimeReplayableSource would allow users to pull and replay messages from a startTime.
TimeStampFilter filters message comparing its TimeStamp with the predicate.
TimeReplayableSource would allow users to pull and replay messages from a startTime.
The typical usage is like the following, where user get startTime from TaskContext in onStart and pull num of messages in each onNext. User could optionally append a TimeStampFilter in case source messages are not stored in TimeStamp order
e.g. class UserTask(conf: Configs) extends TaskActor(conf) { var startTime = 0L
override def onStart(context: TaskContext): Unit = { this.startTime = context.startTime TimeReplayableSource.setStartTime(this.startTime) }
override def onNext(msg: Message): Unit = { TimeReplayableSource.pull(num).foreach { msg => TimeStampFilter.filter(msg, this.startTime).map(output) } } }