This recipe demonstrates creating groups of worker pools and connecting them together to form a pipeline. For this recipe, we link together two pools, but the pattern can be used for much more complex operations similar to middleware.
Worker pools can be useful to keep workers relatively simple and to also further control concurrency. For example, it may be useful to serialize logging while parallelizing other operations. This may also be useful to have a smaller pool for more expensive operations, so you don't overload machine resources.
Using workers to create pipelines
Getting ready
Refer to the Getting ready section of the Using channels and the select statement recipe in this chapter.