Channels

Named merge point with storage and taps. The universal communication primitive. Rooms, topics, timelines, feeds — all the same construct.

Channel Structure

A channel is a named merge point where producers converge, optionally persist to vault, and distribute to consumers.

.zpchannel structure
channel("orders") : producers -> | merge | -> vault.append -> consumers

Channel Patterns

.zpchat room
// chat room — voices merge by time, reach all ears
channel("general") : members.voice -> | merge(by: time) | -> members.ears
.zpmessage queue
// message queue topic — producers merge, persist, distribute
channel("orders") : producers -> | merge | -> vault.append -> consumer_groups
.zpsocial timeline
// social timeline — followed voices merge into your feed
channel(user.timeline) : follows.voice -> | merge(by: time) | -> user.ears

Channel Properties

Named identity

Every channel has a name. Producers and consumers reference it by name.

Merge policy

By time, by priority, by score. The channel decides how signals combine.

Optional storage

vault.append for persistence. Channels can be ephemeral or durable.

Consumer tracking

Position/offset for replay. Consumers can resume where they left off.

Channel + Tap

Channels can be tapped for monitoring without affecting the flow. Telemetry on communication is just another tap.

.zpchannel taps
// monitor order throughput
channel("orders") ~> rate(per: 1s) ~> orders_per_second

// monitor message latency
channel("orders") ~> latency ~> gate(> 100ms) -> slow_alert

// count active consumers
channel("orders") ~> consumer_count -> dashboard

Example: Event-Driven Architecture

.zpevent-driven
// user actions flow into channels
user.click    -> channel("events")
user.purchase -> channel("events")
user.signup   -> channel("events")

// different consumers process different events
channel("events") -> gate(type: "purchase")
    -> channel("billing") -> process_payment

channel("events") -> gate(type: "signup")
    -> channel("onboarding") -> welcome_flow

// all events persist for replay
channel("events") -> vault.append("event_log", immutable: true)