Skip to content

ironflow stream

Manage entity streams for event sourcing.

Terminal window
ironflow stream <subcommand> [flags]

Entity streams store domain events per entity with optimistic concurrency control.

Append a domain event to an entity stream.

Terminal window
ironflow stream append <entity-id> [flags]

Arguments:

ArgumentRequiredDescription
entity-idYesThe entity ID to append the event to

Flags:

FlagShortTypeDefaultDescription
--typestringEntity type (e.g., Order, User)
--eventstringEvent name (required)
--data-dstringEvent data as JSON string
--data-file-fstringPath to JSON file with event data
--expected-versionint64-1Expected stream version (-1=skip, 0=new, N=exact)
--versionint1Event schema version
--idempotency-keystringIdempotency key for deduplication
--jsonboolfalseOutput as JSON
--server-sstringServer URL override

Data input follows the same rules as emit (flag vs file vs stdin, error on conflict).

Examples:

Terminal window
# Append an event
ironflow stream append order-1 --type Order --event order.placed --data '{"amount": 100}'
# Append from file
ironflow stream append order-1 --type Order --event order.paid --data-file payment.json
# With optimistic concurrency
ironflow stream append order-1 --type Order --event order.shipped --expected-version 2
# Pipe from stdin
echo '{"status": "done"}' | ironflow stream append order-1 --type Order --event order.completed

Output:

Event appended: evt_01HN8K3X5Y
Entity: order-1
Version: 3

Read events from an entity stream.

Terminal window
ironflow stream read <entity-id> [flags]

Arguments:

ArgumentRequiredDescription
entity-idYesThe entity ID to read

Flags:

FlagShortTypeDefaultDescription
--from-versionint640Start reading from this version
--limitint100Maximum number of events to return
--directionstringforwardRead direction (forward or backward)
--jsonboolfalseOutput as JSON
--server-sstringServer URL override

Output:

VERSION NAME DATA TIMESTAMP
1 order.placed {"amount":100} 2025-01-15 12:00:05
2 order.paid {"payment_id":"pay_123"} 2025-01-15 12:01:30

Examples:

Terminal window
ironflow stream read order-1
ironflow stream read order-1 --limit 10
ironflow stream read order-1 --from-version 5 --direction backward
ironflow stream read order-1 --json

Get metadata about an entity stream.

Terminal window
ironflow stream info <entity-id> [flags]

Arguments:

ArgumentRequiredDescription
entity-idYesThe entity ID to inspect

Flags:

FlagShortTypeDefaultDescription
--jsonboolfalseOutput as JSON
--server-sstringServer URL override

Output:

Entity ID: order-1
Entity Type: Order
Version: 3
Events: 3
Created: 2025-01-15T12:00:05Z
Updated: 2025-01-15T12:01:30Z

List entity streams with optional filtering by type.

Terminal window
ironflow stream list [flags]

Flags:

FlagShortTypeDefaultDescription
--typestringFilter by entity type
--limitint50Maximum number of streams
--offsetint0Offset for pagination
--jsonboolfalseOutput as JSON
--server-sstringServer URL override

Output:

ENTITY_ID TYPE VERSION EVENTS UPDATED
order-1 Order 3 3 2m ago
order-2 Order 1 1 5m ago
user-1 User 2 2 1h ago

Watch real-time events for an entity stream via WebSocket.

Terminal window
ironflow stream subscribe <entity-id> [flags]

Arguments:

ArgumentRequiredDescription
entity-idYesThe entity ID to subscribe to

Flags:

FlagShortTypeDefaultDescription
--server-sstringws://localhost:9123/ws (derived from IRONFLOW_SERVER_URL if set)WebSocket server URL
--replay-rint0Number of historical events to replay
--json-jboolfalseOutput events as JSON
--metadata-mboolfalseInclude event metadata

Examples:

Terminal window
ironflow stream subscribe order-123
ironflow stream subscribe order-123 --replay 10
ironflow stream subscribe order-123 --json