darkmarmot
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.
Most Liked
benwilson512
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.
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance









