locked
Chain of Responsibility: RRS feed

  • Question

  • User2048898515 posted

    Hi Guys,
    I have a process it has 8 tasks. First four tasks depends on completion of earlier Tasks.
    Last 4 tasks can run in parallel. So for this scenario can i go for Chain of Responsibility?
    How to implement in Chain of Responsibility for the parallel tasks?
    Generally in Chain of Responsibility on completion of task other starts.
    Check below screen shot.

    https://ibb.co/ngrjZo

    Thursday, June 28, 2018 11:36 AM

All replies

  • User1120430333 posted

    Why are you concerned with what is happening after task 4 if all the tasks can run together after task 4? 

    There are example code on how to implement Chain of Responsibility in C# and JavaScript, if you use Bing or Google to find them. 

    Friday, June 29, 2018 9:14 AM
  • User-1611549905 posted

    For something like this I'd just keep it simple:

    await Task1();
    await Task2();
    await Task3();
    await Task4();
    
    Task.WaitAll(Task5(), Task6(), Task7(), Task8());

    You only need a Chain of Responsibility if you don't know in advance how many tasks you need to run. Don't over-complicate things.

    Monday, July 2, 2018 12:14 PM