Skip to main content
Topic-based publish/subscribe messaging for broadcasting events to multiple subscribers in real time.

Sample Configuration

Configuration

Adapter
The adapter to use for pub/sub distribution. Defaults to local (in-memory) when not specified.

Adapters

local

In-memory pub/sub using broadcast channels. Messages are delivered only to subscribers running in the same engine process. No external dependencies required.

redis

Uses Redis Pub/Sub as the backend. Enables event delivery across multiple engine instances.

Configuration

string
The URL of the Redis instance to use.

Functions

function
Publish an event to a topic. All functions subscribed to that topic will be invoked with the payload.
string
required
The topic to publish to. Must not be empty.
any
required
The event payload to broadcast. Can be any JSON-serializable value.
null
Returns null on success.

Trigger Type

This worker adds a new Trigger Type: subscribe.

Subscribe Event Payload

The handler receives the raw value passed as data to the publish call. No envelope is added.
any
The exact value published to the topic. Shape is determined entirely by the publisher.

Sample Code

Usage Example: Fanout Notification

One publisher triggers two independent subscribers on the same topic:

PubSub vs Queue

PubSub Flow