Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scala actors: two different approaches to a scheduled multi-thread application

I'm new to Scala Actors. What I plan to build is an application that has several cartridges that each do a specific http call and retrieve+persist some info periodically. Robustness is what matters the most. So far these are the ways I've thought of:

  1. Build the app around a TimerTask, extend cartridges from Actor and call their .act s periodically (or should I send them messages instead? what's the difference?)
  2. Extend from Actor and use Timeouts to periodically run them.

Can someone shed some light on the differences?

like image 507
parsa Avatar asked Jan 19 '23 08:01

parsa


1 Answers

Scala Actors will be merged with Akka so take a look at http://akka.io,

You can use Akka's "Scheduler" to schedule messages to be sent to actors at certain intervals, it's all in the docs:

http://akka.io/docs/akka/1.1.3/

Hope this helps,

Cheers, √

like image 136
Viktor Klang Avatar answered Feb 13 '23 18:02

Viktor Klang