Skip to main content

Conditional Execution

When a processor is attached to a connector or to a pipeline, we may still want to specify conditions for its execution. To do this, we can add a condition key to the processor definition in the Pipeline Configuration File, or using the HTTP API including this parameter in the POST request.

Processor condition

The condition key follows the Go templates format, allowing the use of any function provided by sprig.

If the expression evaluates to true, the processor will be executed; otherwise, the record will continue to flow in the pipeline without being processed by this processor.


Conduit will parse the output of the go template using strconv.ParseBool which means that 1, t, T, TRUE, true and True will all evaluate to true, while 0, f, F, FALSE, false, False will be evaluated to false. If an expression can't be evaluated as a boolean, the processor will return an error.

Example of a condition

Here's an example of a simple condition. In this case, records will be processed by the json.decode builtin processsor when he OpenCDC Metadata contains a key named key which value is equal to expected-value.

version: 2.2
- id: example-pipeline
# define source and destination connectors
# ...
- id: extract-name
plugin: json.decode
condition: `{{ eq .Metadata.key "expected-value" }}`

scarf pixel conduit-site-docs-processors