Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Akka have a react as well like Scala? or is it handled by dispatchers?

According to my understanding, it does not, there are 2 ways to create an actor which is by either extending the Actor class and implementing receive or by creating an anonymous Actor using one of the actor methods. So far so good.

Akka has a concept of dispatchers (http://akka.io/docs/akka/1.1.3/scala/dispatchers.html), so does that mean that once I create an actor and implement the receive, by default I get the event dispatcher which is similar to the react in Scala? Of course, if i need to tie my actor to the thread of the OS then I would be using the thread based dispatcher, is this similar to receive in Scala?

like image 606
Vikas Hazrati Avatar asked Aug 16 '11 06:08

Vikas Hazrati


People also ask

What are dispatchers in Akka?

An Akka MessageDispatcher is what makes Akka Actors “tick”, it is the engine of the machine so to speak. All MessageDispatcher implementations are also an ExecutionContext , which means that they can be used to execute arbitrary code, for instance Future s .

Which dispatcher is used for testing purpose in Akka?

The thread pool executor dispatcher is implemented using by a java. util. concurrent. ThreadPoolExecutor .

Is Akka scalable?

Akka is a very scalable piece of software, not only in the context of performance but also in the size of applications it is useful for. The core of Akka, akka-actor, is very small and easily dropped into an existing project where you need asynchronicity and lockless concurrency without hassle.

Does Akka use threads?

Behind the scenes, Akka runs actors on real threads and many actors may share one thread. A Actor can create many actors called child actors. Actors interact only through asynchronous messages and never through direct method calls.


1 Answers

Akka has a concept of dispatchers (http://akka.io/docs/akka/1.1.3/scala/dispatchers.html), so does that mean that once I create an actor and implement the receive, by default I get the event dispatcher which is similar to the react in Scala?

Yes.

Of course, if i need to tie my actor to the thread of the OS then I would be using the thread based dispatcher, is this similar to receive in Scala?

Yes.

like image 70
Alexey Romanov Avatar answered Oct 13 '22 18:10

Alexey Romanov