Akka Streams / Play pattern

20 views
Skip to first unread message

ivan morozov

unread,
Jun 21, 2017, 3:55:25 PM6/21/17
to Akka User List
I want to build a play application fetching different API's, persisting the processed results and stream the results via WebSockets to web clients.

I have N actors for N API's  in the main controller who are injected by AkkaGuice. 

Then I have N GraphStages that are in fact responsible for the whole process of getting Data from the DataSources do all the preprocessing, persisting the data and publishing the data to the ActorSystem event stream. 

The API actors subscribe the ActorSystem event stream look for Messages of their interest and forward them to the Dynamically Created User Actors (here I used the pattern from the https://github.com/playframework/play-scala-websocket-example)

I really enjoy the idiomatic approach writing data processing logic with the graph DSL but publishing the data on the EventStream feels wrong. 

I thought something about to have a single graph stage that I inject inside the controller by starting the app which handles the whole fetching and persistence logic but also is able to distribute the data to the dynamical group of user actors but without publishing it to the EventStream

Is there an idiomatic approach to solving my problem?

Thanks
Ivan


Reply all
Reply to author
Forward
0 new messages