I am new to the hole scala/akka ecosistem.
I have a akka-http route defined like:
object RestServiceApp extends CassandraConnector with Directives with JsonSupport {
def main(args: Array[String]) {
val config = ConfigFactory.load()
implicit val actorSystem = ActorSystem("system", config)
implicit val actorMaterializer = ActorMaterializer()
var myFilterList = Seq(3L,32L,55L)
val route: Route = {
get {
path("foo") {
complete( foo().filter(element => myFilterList.contains(element) )
}
}
}
foo() is a function that returns elements
I filter that elements and return the list
I want to:
- Update the myFilterList every M minutes
- For doing that I have to make a Mysql query
I don't care about the performance of the query, I care about being able to continue responding to http request while the new myFilterList is being loaded.
How can I achieve this?
Thanks!