Channel API

Channels are named conduits for events. They route events between agents and connect to external systems via sinks.

Creating Channels

Main Channel

const main = mainChannel('main');

Designates the channel where start events are published. Every network has exactly one main channel.

Additional Channels

const processing = createChannel('processing');
const client = createChannel('client');

Channel names must be kebab-case (e.g. 'main', 'client-output').

Channel Configuration

.events([...])

Optionally declare which events a channel carries:

const client = createChannel('client')
  .events([responseEvent, errorEvent]);

.sink(sinkFactory)

Attach a sink. Can be called multiple times for multiple sinks.

Sink Factories

Sink
Description

sink.httpStream()

Streams events as SSE to HTTP clients

sink.kafka({ topic })

Publishes events to a Kafka topic

See Also

Last updated