title: Reactive Execution of a Dependency Graph
body: <p>I need to create a service (using Java) that accepts a graph of tasks and executes them in parallel, while considering the dependencies between those tasks.</p>
  
  <p>For example, let's take 6 tasks: A, B, C, D, E, F.</p>
  
  <p>Dependencies are:</p>
  
  <p>A -> C</p>
  
  <p>B -> C, D</p>
  
  <p>C -> F</p>
  
  <p>D -> E</p>
  
  <p>E -> F</p>
  
  <p>This would create (one of the possible) parallel execution groups: A+B, C+D, E, F.</p>
  
  <p>If a task execution was not successful (returned an error), its dependent tasks will not be executed.</p>
  
  <p>Another requirement is to have a side effect for the task execution (or failure): notify some other service about it (which means we have to treat dependencies of a failed tasks as failed too?).</p>
  
  <p>When all tasks were treated (direct success or failure + failure of a dependency), I'd like to mark this "batch" as completed (call to another service).</p>
  
  <p>I thought about taking the reactive approach to this problem and use RxJava due to its async nature.</p>
  
  <p>I am quite new to this approach, and while zip / switchMap combined with doOnComplete / doOnError seems like a good direction, I am not quite sure on how to use them in this context.</p>
  
  <p>Would be glad to get some advice here :)</p>