Soccertrash
Soccertrash

Reputation: 1901

Long-running tasks in AKKA actors

What is the best way to implement long running tasks in AKKA actors?

Examples for long-running tasks: 1) File IO 2) Multimedia (Video/Audio) IO

If I let an Actor record from a microphone or play a sound/song to the speakers it has to block a thread. But - as far as I understand AKKA Actors - this blocked Actor does not react from any messages from outside. Thus I don't have the possibility to interrupt (or pause) my long running task.

Is there a standard way to achieve my goal? Or are Actors the wrong model for this certain kind of tasks?

Upvotes: 1

Views: 1632

Answers (1)

Viktor Klang
Viktor Klang

Reputation: 26579

Use the new Akka IO (coming in 2.2.0, now in RC1), it offers non-blocking message-driven TCP & UDP for Actors.

http://doc.akka.io/docs/akka/2.2.0-RC1/scala/index-network.html

What you will generally do is to put things into chunks and handing one chunk at a time, not blocking for the next chunk.

Upvotes: 1

Related Questions