I use participants when I need to run two threads at the same time. I never use streams explicitly.
someone told me that the actors are pretty heavy and not always good to use.
What are the right scenarios for using actors and when not to use them?
Some of my actors just have a loop, but they donβt respond. Is this a good practice?
[EDIT]
Actors provide a distributed asynchronous algorithm with a message passing model with computation and are most suitable for tasks corresponding to this model.
Scala , , , , . , .
. Distributed Computing .
, :
,
-, - . - .
, , , , , .
, , .
"" .
, fork/join . Scala 2.9 , .
, , , , :
new Thread(work1).start() new Thread(work2).start()
. , , , , . , , , , , , .
, ForkJoin, Scala actor, . , (, ) /
, , Actors , . - , " " , , .
, Actor , . () . , -.
@Jus12 - , , Akka IO. -, , , . , Akka IO, / ; , "" -.
Testing these participants is very simple. Use AkkaTestKit and make sure that each actor is expected to have a very simple set of inputs.
In many cases, the overhead of using the Akka library is more than paid to reduce the maintenance of your application.