Skip to content

Instantly share code, notes, and snippets.

@ticofab
Last active July 20, 2018 11:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ticofab/24656255f44251eae4446667061a4f85 to your computer and use it in GitHub Desktop.
Save ticofab/24656255f44251eae4446667061a4f85 to your computer and use it in GitHub Desktop.
Source
// emits a GiveToken object once a day
.tick(0.seconds, 1.day, GiveToken)
// asks the Token Actor the auth token, is received as a string
.mapAsync(1)(msg => (tokenActor ? msg) (3.seconds).mapTo[String])
// passes it to the event request flow, implmented separately
.via(eventRequestFlow)
// unmarshal the results and maps it to my internal CoinEvent object
.map(eventListUnmarshaller)
.map(_.flatMap(EventAPI.toCoinEvents)))
// publishes the result on Google Pub/Sub, implemented separately with Alpakka
.via(eventPubSubFlow)
// forwards the event list to the Coin Actor
.runForeach(ev => coinActor ! ev)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment