Skip to content

Instantly share code, notes, and snippets.

@aludwiko
Created November 17, 2017 12:07
Show Gist options
  • Save aludwiko/d757332447ddd7b8c386d58ef3cf87d3 to your computer and use it in GitHub Desktop.
Save aludwiko/d757332447ddd7b8c386d58ef3cf87d3 to your computer and use it in GitHub Desktop.
val roomsTemperatureReadings =
 Stream.continually(TemperatureReading(randomRoom, randomTemperature))
Source(roomsTemperatureReadings)
 .alsoTo(Sink.foreach(reading => createRoomIfNotExist(reading.roomId)))
 .to(Sink.foreach(saveReading))
 .run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment