Skip to content

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).

Trigger a flow by name with the current payload:

steps:
- name: notify-audit
emit: audit-log-flow

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.email

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-check

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 chain
  • parentFlowId — the flow that emitted the message
  • parentMessageId — the specific message that triggered the emission

Use these fields when searching logs to trace execution across flows:

Terminal window
fyrn logs search <child-flow-id> --search "correlation-id-value"

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.

# Parent: order-processor
flow: order-processor
version: 1
source:
connector: shopify
trigger: webhook
event: orders/create
steps:
- 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-flow
flow: billing-flow
version: 1
source:
connector: order-processor
trigger: webhook
target:
connector: payment-api
endpoint: /api/charges
method: POST
mapping:
order_ref: source.order_id
amount: source.amount | decimal(2)
receipt_email: source.customer_email
on_error:
retry: 3x exponential(30s)
then: dead-letter

Use caseApproach
Independent side effects (audit, notifications)Emit — fire and forget
Sequential operations on same dataMulti-step flow with steps
Fan-out to multiple targets by conditionSwitch step or fan-out flow
Modular, reusable processing blocksEmit with custom payloads