So, in Scala Lift, there's one single transaction per request. And I have to, say, process a thousand records, and then what? I thought about adding a request handler per record, and call it via http. Stupid, eh. There are actors. So I wrote the actor, moved all the functionality there, and now I call that actor. Can process that 1000 in parallel now, big deal. And each has its own transaction of course (just switch to
Future
).
def process(lineNo: Int, line: String): Status = {
importActor !? ((lineNo, line)) match {
case s:Status => s
case basura => onError(lineNo, s"Wrong response from importer: $basura")
}
}
I know, it's rather stupid, but well... just having fun