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

Sample Configuration

Configuration

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

Adapters

modules::pubsub::LocalAdapter

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

modules::pubsub::RedisAdapter

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

Configuration

redis_url
string
The URL of the Redis instance to use.

Functions

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

Trigger Type

This module 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.
payload
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