Scala: ¿Conoces algún documento / tutorial avanzado de Actores?

i've been working with Scala for some time and i've started to take a deeper look into concurrency. With my knowldege of Java concurrency i've achieved the simple things I had to do, but i'm trying to dig a little bit more into the Actors world.

The problem is that i can't find any advanced tutorial or docs rather than this one: (pretty good BTW)

Of course i've read the API, but i'd like to have some code examples, good practices, recommendations, etc.

NOTA: I'm talking of documentation about things not covered in the mainstream docs. I know the core concepts of actors. Also, i've read these books:

Programming in Scala: A Comprehensive Step-by-Step Guide, 2nd Edition

Programming Scala: Scalability = Functional Programming + Objects

EDIT: Thank you for all the answers. I'm aware of the books about actors, but i'm looking for free sutff.

preguntado el 01 de febrero de 12 a las 03:02

Este patrón de one could help you. -

3 Respuestas

My starting point was to read some Erlang tutorials such as Aprende algo de Erlang para bien. Erlang has been around for a while and there are lots of tutorials, books, presentations. At the core of Erlang is the actor model, i.e. message passing between shared nothing actors (called processes in Erlang) so it is a good way to get the concepts down.

Then when you turn to Scala for the syntax, use Akka because it's API is much closer to Erlang that the basic Scala actors. Fundamentally, actors in Scala using Akka are very simple. The real challenge is to take a design and to recast it in terms of actors with NO shared data whatsoever. There is a temptation with Scala to just use some Java libraries and to some object-oriented design and end up with something that is not quite compatible with actors.

I suggest starting from an actors point of view, hash out a workable design, and then enhance that with Java classes and object-oriented techniques. For instance in my first Akka-based application, I used the ordinary Java AMQP library to consume messages rather than the Akka abstraction, because the Java class was simple and I was already intimately familiar with AMQP.

Respondido 01 Feb 12, 10:02

También hay este libro. It's pretty well written, although when I read it, it didn't talk about Akka at all, which is a little awkward, since Akka is used bastante. In fact, I wouldn't be surprised if there was some convergence between Scala's own actors and Akka's actors in the near future (towards Akka's model).

Actores en Scala

Respondido 01 Feb 12, 11:02

Akka will indeed replace the Scala actors. See aquí. - dhg

Which means that this book is unfortunately going to be obsolete before too long. - Jesper

The latest version does cover Akka (though not in depth). - fuentedelica

Aquí is a small code example I wrote that solves one of the Project Euler problems using Akka actors. It uses actors sort of like a map/reduce operation, where workers are processing pieces of data in parallel and sending their results to a collector. The whole thing is asynchronous and could (hypothetically) scale out to thousands or millions of nodes.

The code has gone through several iterations as I've learned more about how to use Actors (and I'm still learning!), so looking at earlier revisions might give you some insight into how I arrived at the current design.

Respondido 01 Feb 12, 21:02

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.