I have a scala main class
object Job extends App {
def myProcedure() = {
sqlu"""CALL `dbName`.`update_history();"""
}
implicit val system: ActorSystem = ActorSystem()
implicit val mat: ActorMaterializer = ActorMaterializer()
implicit val ec = system.dispatcher
implicit val session: SlickSession = SlickSession.forConfig("my-mysql")
val proc = session.db.run(myProcedure))
val terminatedF = proc.flatMap { rec =>
println("value of the procedure ::" + rec)
session.close()
system.terminate()
}
Await.result(terminatedF, Duration.Inf)
println("terminated :::")
}
I see that the value of rec
gets printed, and also terminated :::
i.e. last line also gets printed. However the program does not end. Am I missing anything here ?
This was a problem with user defined threads.
I used
Await.result
on the last Future and then didsys.exit(0)
. Also inbuild.sbt
I used
This perfectly works