Can two things read the same output?
Available — v0.0.1 (experimental)starlark
Branch without running twice
One lowercase step feeds two consumers. It runs once; both get every record.
Available in v0.0.1: the files, README and tests are in examples/email/normalize-and-mask-email-branching of the openflange-go repository. Commands run from the repository root.
Needs: only the openflange CLI.
A pipe is a data-processing step with declared inputs and outputs.
What goes in, what comes out
Input (stdin)
"Alice@Example.COM"Command
printf '"Alice@Example.COM"\n' | openflange run ./examples/email/normalize-and-mask-email-branching --output masked=masked.ndjson --output normalized=-Outputs
# normalized (stdout)
"alice@example.com"
# masked.ndjson
"a***e@example.com"Files and further commands
examples/email/normalize-and-mask-email-branching/pipeline.yaml
# Branching variant: lowercase.outputs.text has two consumers (broadcast).
spec: openflange.org/pipeline/v0.1
nodes:
lowercase:
pipe: ../pipes/lowercase
inputs:
text: {from: inputs.email}
mask:
pipe: ../pipes/mask-email
inputs:
email: {from: lowercase.outputs.text}
outputs:
masked: {from: mask.outputs.email}
normalized: {from: lowercase.outputs.text}
rejected: {from: mask.outputs.rejected}What to notice
- There is no
connectionssection and nothing to configure on the producer. A consumer names the output it reads; a second consumer naming the same output makes it a broadcast. - The slowest consumer sets the pace. Buffers are bounded, so a slow branch slows the producer instead of filling memory.
- The third output,
rejected, is optional: the command above leaves it unbound, so an invalid address would fail the run. Bind it with--output rejected=rejected.ndjsonto keep the run alive. - The opposite case — two producers into one input — is never implicit. Add an explicit
std:mergenode. - This directory has no README of its own in the repository: the command is the one shown by
openflange help run, and the output is from a run of the source build.