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

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

Subscribes the given handler on every redis host in the cluster, and remembers the subscription so servers that join later are subscribed automatically.

**Signature:**

```typescript
subscribe(channel: string, handler: (data: JsonObject) => void): Promise<void>;
```

## Parameters


| Parameter | Type | Description |
| --- | --- | --- |
| channel | string | channel name within the queue's prefix namespace |
| handler | (data: [JsonObject](https://imqueue.org/api/core/latest/core.jsonobject/)) => void | invoked with the parsed payload of each published message |


**Returns:**

Promise<void>

## Exceptions

TypeError when a different channel name is supplied while a subscription is already open on the underlying queues

## Remarks

Only one channel per instance is supported. Calling this again with the same channel registers the handler a second time; calling it with a different channel rejects — and the remembered subscription is left pointing at the rejected name, which is what newly joining servers would then use.

The handler receives one invocation per host that delivers the message.

