This is a very basic technology demo for libraries in the Typelevel ecosystem, primarily fs2 and doobie. It uses the cats-effect runtime.
The utility uses the OpenWeatherMap API to stream weather data for configured locations, perform some transformations, and record it in a Postgres database.
There is also a much more developed ZIO-based version of this demo.
By default, a postgres
database is needed to run the demo. The schema can be found here.
Alternatively, to simply log data to console, one could comment out the database stage of the stream in Main.run()
:
// .flatMap { chunk =>
// // write each batch as a single operation
// // this can also be done as a pipe along with the grouping
// Stream.eval(writeSamples(chunk.toList*))
// }
There is currently no configuration file. See Main.scala
to set owmApiKey
constant and to configure the database Transactor
.
You can compile code with sbt compile
, run it with sbt run
.