ClusteredRedisQueue.publish() method

Publishes the payload on every redis host in the cluster.

Signature:

publish(data: JsonObject, toName?: string): Promise<void>;

Parameters

Parameter

Type

Description

data

JsonObject

payload to publish as a channel message

toName

string

(Optional) optional different pub/sub name to publish to

Returns:

Promise<void>

Exceptions

TypeError propagated from any host that has no writer connection

Remarks

This is the opposite of ClusteredRedisQueue.send(): the same payload goes to all hosts. A subscriber connected to several of them therefore receives one copy per host.

Publication is not atomic — if any host has no writer connection the call rejects even though other hosts may already have published. On an empty cluster it resolves without publishing anything, and unlike send() it does not wait for a server to appear.

Read this page as plain markdown — no HTML, no navigation. For pasting into an LLM, or for an agent to fetch.