Best way to compose a stream as an event source that can be paused?

I’m not sure if I’m trying to shoehorn functionality into the Stream module that shouldn’t be there – but here’s my basic use case:

I have a large file of timed events, so an event source log more or less.

I’d like to have a process that could stream the file, emitting the events with real delays based on timestamp values, i.e. historical playback.

I can compose a stream to do this – but I can only run and kill it as a process, whereas I could like to control it to modify playback speed, pause it, etc.

Is there a good or canonical way to partially process a file like this with breaks in which I can intersperse commands?

Thanks!
Scott S.

1 Like

This seems like a great fit for GenStage. You could wrap the file in a GenStage Producer, and that producer could be instructed to play forward up to N events, or otherwise receive any other kinds of messages or instructions you want to send it.

3 Likes

I’ll look into that, thanks! :slight_smile: