pubsub
pubsub
Deprecated: pubsub is deprecated (pubsub) and will be removed in an upcoming release. Behavior is unchanged for now. Migration guide: https://github.com/iii-hq/iii/blob/6901a589dd39d9c34f9d5b6bd8bc82170ee21548/docs/next/upgrading/migrate-from-streams.mdx
Applies to
publishand thepubsubconfiguration entry. Do not start new work on it: observe a worker-owned event function for fire-and-forget fan-out, or use thequeueworker (iii::durable::publishobserved throughqueue::on-message) when every event must be processed. The worker logs rate-limited deprecation warnings (targetiii::deprecation); topicstream.events, used by the engine's iii-stream bridge, is exempt.
The pubsub worker is topic-based publish/subscribe messaging. Publish an event to a named topic with the publish function, and every observer of publish whose filter selects that topic receives { topic, data } — no persistence, no retries. It is fire-and-forget broadcast: observers receive each event as it arrives, and a target that is offline simply misses it.
Install it with iii call compose::add worker=pubsub. It replaces the former in-engine pub/sub service: the function id (publish) is unchanged, so existing publishers keep working — only the owner moved from an in-process builtin to this standalone worker.
The worker exposes one function, publish, registered with the bare function id "publish" (no namespace prefix). Any worker may call it, and subscribers observe it. Two adapters: local (default; events stay on this engine; no external dependency) and redis (redis_url: ${REDIS_URL:redis://localhost:6379}; uses Redis Pub/Sub so events also reach the observers on other engines). The adapter is set in the pubsub configuration entry and hot-swaps at runtime.
When to Use
- Real-time notifications consumers may miss without consequence — UI live updates, ephemeral signals, telemetry mirroring.
- Loose coupling where an event source should not know about its consumers.
- Cross-engine fan-out of ephemeral events (configure the
redisadapter).