Scala - calculate with Futures, sequentially and parallel
When we use Futures in scala sometimes we need to combine sequentially and parallel execution of Futures. My research in this way is beginning from a task - generate a lot of Users (100K) and insert it all in different databases (Postgres and Cassandra) to make common score of write speed. case class User(id: Long, name: String, email: String, edomain: String) For Postgres, I should have used Slick library and for Cassandra Phantom library (Schema safe, type-safe, reactive Scala driver for Cassandra/Datastax Enterprise). Steps ware easy, generate Seq of Users and in loop insert there into a database. With Postgres driver and with this count of items it was ok, every row was inserted without error. But Phantom is reactive and insert command return Future. (somewhere about) A snippet of code: abstract class CassUsers extends Table[CassUsers, User] with RootConnector { override def tableName: String = "us...