Problem
When flow is completed or an exception occurs, this information is also propagated, closing the intermediate steps along the way. So, as they all flow, we can listen for values, exceptions, or other characteristic events (like starting or completing). Write a program to choose a method to listen for values. Remember to select a function to set a listener that should be called immediately once the flow starts.
Restriction
The output will be available in the terminal.
Output
The output will be as follows; here, we’ll see a delay of 2 seconds before each value as it flows.
Started
A
B
Get hands-on with 1200+ tech skills courses.