title: What C# tools exist for triggering, queueing, prioritizing dependent tasks
body: <p>I have a C# service application which interacts with a database.  It was recently migrated from .NET 2.0 to .NET 4.0 so there are plenty of new tools we could use.</p>
  
  <p>I'm looking for pointers to programming approaches or tools/libraries to handle defining tasks, configuring which tasks they depend on, queueing, prioritizing, cancelling, etc.</p>
  
  <p>There are various types of services:</p>
  
  <ul>
  <li><strong>Data</strong> (for retrieving and updating)</li>
  <li><strong>Calculation</strong> (populate some table with the results of a calculation on the data)</li>
  <li><strong>Reporting</strong></li>
  </ul>
  
  <p>These services often depend on one another and are triggered on demand, i.e., a <strong>Reporting</strong> task, will probably have code within it such as </p>
  
  <pre><code>if (IsSomeDependentCalculationRequired())
      PerformDependentCalculation();  // which may trigger further calculations
  GenerateRequestedReport();
  </code></pre>
  
  <p>Also, any <strong>Data</strong> modification is likely to set the <code>Required</code> flag on some of the <strong>Calculation</strong> or <strong>Reporting</strong> services, (so the report could be out of date before it's finished generating).  The tasks vary in length from a few seconds to a couple of minutes and are performed within transactions.</p>
  
  <p>This has worked OK up until now, but it is not scaling well.  There are fundamental design problems and I am looking to rewrite this part of the code. For instance, if two users request the same report at similar times, the dependent tasks will be executed twice.  Also, there's currently no way to cancel a task in progress.  It's hard to maintain the dependent tasks, etc..</p>
  
  <p>I'm NOT looking for suggestions on how to implement a fix.  Rather I'm looking for pointers to what tools/libraries I would be using for this sort of requirement if I were starting in .NET 4 from scratch.  Would this be a good candidate for <a href="http://msdn.microsoft.com/en-us/netframework/aa663328" rel="nofollow"><strong>Windows Workflow</strong></a>?  Is this what <a href="http://msdn.microsoft.com/en-us/library/ff963556.aspx" rel="nofollow"><strong>Futures</strong></a> are for?  Are there any other libraries I should look at or books or blog posts I should read?</p>
  
  <p><strong>Edit:</strong> What about <a href="http://msdn.microsoft.com/en-us/data/gg577609" rel="nofollow">Rx Reactive Extensions</a>?</p>