Concurrency patterns
The way we organize our concurrent work is pretty much the same in every application. We will look at one common pattern that is called a pipeline, where we have a source, and then messages are sent from one Goroutine to another until the end of the line, until all Goroutines in the pipeline have been utilized. Another pattern is the fan out/ fan in pattern where, as in the previous exercise, work is sent to several Goroutines reading from the same channel. All these patterns, however, are generally made of a source stage, which is the first stage of the pipeline and the one that gathers, or sources, the data, then some internal steps, and at the end, a sink, which is the final stage where the results of the process from all the other routines get merged. It is known as a sink because all the data sinks into it.