# ClusteredRedisQueue.publish() method · @imqueue/core

Source: https://imqueue.org/api/core/latest/core.clusteredredisqueue.publish/
Published: 2026-08-04
Author: @imqueue maintainers (https://github.com/imqueue)
Package: @imqueue/core 3.3.2 — generated reference, not hand-written

Publishes the payload on every redis host in the cluster.

**Signature:**

```typescript
publish(data: JsonObject, toName?: string): Promise<void>;
```

## Parameters


| Parameter | Type | Description |
| --- | --- | --- |
| data | [JsonObject](https://imqueue.org/api/core/latest/core.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()](https://imqueue.org/api/core/latest/core.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.

