How it works...

The github.com/trustmaster/goflow package works by defining a network/graph, registering some components, and then wiring them together. This can feel a bit error-prone since components are described using strings, but usually this will fail early in runtime until the application is set up and functioning correctly.

In this recipe, we set up two components, one that Base64-encodes an incoming string, and one that prints anything passed to it. We connect it to an in channel that is initialized in main.go, and anything passed onto that channel will flow through our pipeline.

A lot of the emphasis of this approach is on ignoring the internals of what's going on. We treat everything like a connected black box and let goflow do the rest. You can see, in this recipe, how small the code is to accomplish this pipeline of tasks and that we have fewer knobs to control the number of workers, among other things.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.147.103.8