Is Akka a good solution for a concurrent pipeline/workflow problem?
- by herpylderp
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:
ESB/Apache Camel
Guava Event Bus
Java 5 Concurrency
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?