The Sink componentΒΆ

We have seen how to fan-out the stream of messages with The Pipeline component. The next step is to learn how to fan-in a series of streams and join the output. This can be done via the pylm.servers.Sink server.

A Sink server can subscribe to one or many components of type pylm.servers.Server or pylm.servers.Pipeline, and fetch all the message every previous step releases. The configuration is similar to a Pipeline component, only the sub_addresses and the previous parameters require further comment. Since the component must connect to multiple components upstream, these parameters are of type list, sub_addresses are the list of addresses the component has to connect to, and previous are the topics for subscription. The values of these two parameters are zipped, so the order of the elements matter.

You can see a complete example of the use of a pylm.servers.Sink in A pipelined message stream forming a tee and controls the stream of messages with a sink.

_images/pipeline-stream-sink.png

In this sketch, the sink is attached to two pipeline servers that process a divided stream of messages. One of the possible uses of sink components is to synchronize the stream of messages or to check for completion.