Flow Chaining
Flow chaining lets you break complex integrations into smaller, focused flows that trigger each other. The emit step fires a child flow without waiting for it to complete (fire-and-forget).
The emit step
Section titled “The emit step”String shorthand
Section titled “String shorthand”Trigger a flow by name with the current payload:
steps: - name: notify-audit emit: audit-log-flowObject with custom payload
Section titled “Object with custom payload”Send a subset of data to the child flow:
steps: - name: send-notification emit: flow: notification-flow payload: subject: "'New order received'" order_id: source.id customer_email: source.customer.emailMulti-emit
Section titled “Multi-emit”Trigger multiple flows from a single step:
steps: - name: high-value-alerts when: source.total_price > 1000 emit: - flow: vip-handler payload: customer: source.customer.email - flow: fraud-checkCorrelation IDs
Section titled “Correlation IDs”When a flow emits a child flow, fyrn automatically generates a correlationId and attaches it to every message in the chain. If the parent flow was itself triggered by an emit, the existing correlation ID propagates forward rather than creating a new one. This means a single correlation ID spans the entire execution tree, no matter how many levels deep.
Each emitted message also carries parentFlowId and parentMessageId fields. These let you reconstruct the exact causal chain: which flow fired the emit, and which specific message execution triggered it. Together with the shared correlation ID, you get full end-to-end traceability across flows without any manual instrumentation.
Every emitted message carries:
correlationId— shared across the entire chainparentFlowId— the flow that emitted the messageparentMessageId— the specific message that triggered the emission
Use these fields when searching logs to trace execution across flows:
fyrn logs search <child-flow-id> --search "correlation-id-value"Parent/child relationships
Section titled “Parent/child relationships”Flow chaining forms a directed acyclic graph. A parent flow emits to one or more child flows, and each child can emit further, creating multi-level pipelines. There is no hard-coded depth limit, but fyrn enforces a default maximum chain depth of 10 to prevent runaway recursion. You can adjust this with the maxChainDepth setting in your flow config if your use case requires deeper nesting.
To visualize the dependency graph across your flows, run fyrn flows graph in the CLI. This outputs a map of all emit relationships in your workspace, making it straightforward to audit which flows depend on each other and identify unintended cycles or orphaned chains.
Example: Order processing pipeline
Section titled “Example: Order processing pipeline”# Parent: order-processorflow: order-processorversion: 1source: connector: shopify trigger: webhook event: orders/createsteps: - name: classify when: source.total_price > 1000 tag: high-value
- name: process-billing emit: flow: billing-flow payload: order_id: source.id amount: source.total_price customer_email: source.customer.email
- name: send-notifications emit: flow: notification-flow payload: order_id: source.id customer_name: source.customer.name
- name: fraud-check when: tagged(high-value) emit: fraud-check-flow# Child: billing-flowflow: billing-flowversion: 1source: connector: order-processor trigger: webhooktarget: connector: payment-api endpoint: /api/charges method: POSTmapping: order_ref: source.order_id amount: source.amount | decimal(2) receipt_email: source.customer_emailon_error: retry: 3x exponential(30s) then: dead-letterWhen to use flow chaining
Section titled “When to use flow chaining”| Use case | Approach |
|---|---|
| Independent side effects (audit, notifications) | Emit — fire and forget |
| Sequential operations on same data | Multi-step flow with steps |
| Fan-out to multiple targets by condition | Switch step or fan-out flow |
| Modular, reusable processing blocks | Emit with custom payloads |
What’s next
Section titled “What’s next”- Fan-out Routing — Route to multiple targets based on payload
- Saga Pattern — Distributed transactions with compensation
- DSL Reference — Emit step specification