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:
type Sink interface { // Consume processes a Payload instance that has been emitted out of // a Pipeline instance. Consume(context.Context, Payload) error }
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: