-
Notifications
You must be signed in to change notification settings - Fork 0
Example 5 Fan Out with MultiPipe
Fernando Koch edited this page Mar 30, 2026
·
3 revisions
Understand how GraphK executes several matching branches instead of only one.
Sometimes routing should not be exclusive. Instead of selecting one path, you want all matching paths to run.
import graphk
multi = graphk.MultiPipe(
nodes=[
(graphk.Matcher(group="alpha"), graphk.SequencePipe(nodes=[graphk.demo.IncrementNode("A", target_key="counter", order_key="executed", response=True, response_key="response")])),
(graphk.Matcher(group="alpha"), graphk.SequencePipe(nodes=[graphk.demo.IncrementNode("B", target_key="counter", order_key="executed", response=True, response_key="response")])),
(graphk.Matcher(group="beta"), graphk.SequencePipe(nodes=[graphk.demo.IncrementNode("C", target_key="counter", order_key="executed", response=True, response_key="response")])),
],
)
program = graphk.Program(
{"fanout": graphk.SequencePipe(nodes=[multi])}
)
emitter = graphk.Emitter(program)
emitter.request("fanout", graphk.Session(group="alpha"))
print(emitter.response())- GraphK resolves the
fanoutpipeline from the program - GraphK resolves all matching branches
- the selected branches are ordered
- every selected branch executes
This is GraphK’s cumulative-routing or fan-out pattern.