Producer & Consumer Processors
Route frames between different parts of a pipeline, allowing selective frame sharing across parallel branches or within complex pipelines
Overview
The Producer and Consumer processors work as a pair to route frames between different parts of a pipeline, particularly useful when working with ParallelPipeline
. They allow you to selectively capture frames from one pipeline branch and inject them into another.
ProducerProcessor
ProducerProcessor
examines frames flowing through the pipeline, applies a filter to decide which frames to share, and optionally transforms these frames before sending them to connected consumers.
Constructor Parameters
An async function that determines which frames should be sent to consumers.
Should return True
for frames to be shared.
Optional async function that transforms frames before sending to consumers. By default, passes frames unchanged.
When True
, passes all frames through the normal pipeline flow. When False
,
only passes through frames that don’t match the filter.
ConsumerProcessor
ConsumerProcessor
receives frames from a ProducerProcessor
and injects them into its pipeline branch.
Constructor Parameters
The producer processor that will send frames to this consumer.
Optional async function that transforms frames before injecting them into the pipeline.
The direction in which to push received frames. Usually DOWNSTREAM
to send
frames forward in the pipeline.