Implementing the output sink worker

Of course, our pipeline would not be complete without an output sink! After all, payloads that travel through the pipeline do not disappear into thin air once they clear the pipeline; they must end up somewhere. So, together with an input source, users are expected to provide an output sink that implements the Sink interface:

In order to deliver processed payloads to the sink, the pipeline package will spawn a new goroutine and execute the sinkWorker function, whose implementation is as follows:

Get Hands-On Software Engineering with Golang now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.