1.

What do you mean by Control Flow Functions and how does Control Flow control the functions?

Answer»

A set of code which always operates in between multiple asynchronous function call is called Control Flow. You may describe it as a function because it takes some input and provides you or its next functions an output. Control Flow usually controls the function by using the following steps:- 

  • Control the order of execution 
  • Collect data 
  • Limit concurrency 
  • Call the next step in program 

We have three different patterns which can explain more about control functions :- 

  1. Control flow pattern #1: Series - an asynchronous for loop:- Consider a case when you have multiple programs and the first program provides a feed to the second program, and third to fourth in a sequential manner. So in this case we just need to trigger one async () operation and pass CALLBACK to it. This will trigger all remaining programs and provide you the expected results. 
  2. Control flow pattern #2: Full parallel - an asynchronous, parallel for loop :- Consider a case when our application requires feed from different other systems which may or may not require to run in a sequence. Whenever all PREREQUISITE programs are finished and provide a feed to our application then only our PROCESS will trigger. So this scenario we just have to worry about the available resources so that prerequisite applications should not consume all resources and later applications will always be on HOLD stage.  
  3. Control flow pattern #3: Limited parallel - an asynchronous, parallel, concurrency limited for loop:- In this flow a fresh async () function will call till the time application CONSUMES all the available resources and every operation will store the results of its operation. After successful completion of first async operation launcher() will call it again unless there is no application PENDING to run. Once our application achieves this stage then we will call final() for processing the final information and share the output/result with the user. 


Discussion

No Comment Found