Is Akka a good solution for a concurrent pipeline/workflow problem?

Posted by herpylderp on Programmers See other posts from Programmers or by herpylderp
Published on 2014-06-25T20:10:42Z Indexed on 2014/08/24 22:32 UTC
Read the original article Hit count: 234

Disclaimer: I am brand new to Akka and the concept of Actors/Event-Driven Architectures in general.

I have to implement a fairly complex problem where users can configure a "concurrent pipeline":

Pipeline: consists of 1+ Stages; all Stages execute sequentially
    Stage: consists of 1+ Tasks; all Tasks execute in parallel
        Task: essentially a Java Runnable

As you can see above, a Task is a Runnable that does some unit of work. Tasks are organized into Stages, which execute their Tasks in parallel. Stages are organized into the Pipeline, which executes its Stages sequentially.

Hence if a user specifies the following Pipeline:

CrossTheRoadSafelyPipeline
    Stage 1: Look Left
        Task 1: Turn your head to the left and look for cars
        Task 2: Listen for cars
    Stage 2: Look right
        Task 1: Turn your head to the right and look for cars
        Task 2: Listen for cars

Then, Stage 1 will execute, and then Stage 2 will execute. However, while each Stage is executing, it's individual Tasks are executing in parallel/at the same time.

In reality Pipelines will become very complicated, and with hundreds of Stages, dozens of Tasks per Stage (again, executing at the same time).

To implement this Pipeline I can only think of several solutions:

  1. ESB/Apache Camel
  2. Guava Event Bus
  3. Java 5 Concurrency
  4. Actors/Akka

Camel doesn't seem right because its core competency is integration not synchrony and orchestration across worker threads. Guava is great, but this doesn't really feel like a subscriber/publisher-type of problem. And Java 5 Concurrency (ExecutorService, etc.) just feels too low-level and painful. So I ask: is Akka a strong candidate for this type of problem? If so, how? If not, then why, and what is a good candidate?

© Programmers or respective owner

Related posts about java

Related posts about concurrency