# ClusterManager class · @imqueue/core

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

Abstract base for cluster-membership discovery. A manager tracks the clusters it feeds and pushes server add/remove events into each of them, so several clustered queues can share one discovery mechanism.

Supply instances through [IMQOptions.clusterManagers](https://imqueue.org/api/core/latest/core.imqoptions.clustermanagers/). [UDPClusterManager](https://imqueue.org/api/core/latest/core.udpclustermanager/) is the implementation shipped with the framework.

**Signature:**

```typescript
export declare abstract class ClusterManager 
```

## Remarks

Subclasses must implement [ClusterManager.destroy()](https://imqueue.org/api/core/latest/core.clustermanager.destroy/) to release their transport, and that implementation must be idempotent — `remove()` can invoke it more than once.

## Constructors


| Constructor | Modifiers | Description |
| --- | --- | --- |
| [(constructor)()](https://imqueue.org/api/core/latest/core.clustermanager._constructor_/) | `protected` | Constructs a new instance of the `ClusterManager` class |


## Properties


| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [clusters](https://imqueue.org/api/core/latest/core.clustermanager.clusters/) | `protected` | [InitializedCluster](https://imqueue.org/api/core/latest/core.initializedcluster/)\[\] | Clusters currently registered with this manager. |


## Methods


| Method | Modifiers | Description |
| --- | --- | --- |
| [destroy()](https://imqueue.org/api/core/latest/core.clustermanager.destroy/) | `abstract` | Releases the manager's transport. Implemented by subclasses, and must be safe to call more than once. |
| [forEachCluster(fn)](https://imqueue.org/api/core/latest/core.clustermanager.foreachcluster/) |  | Applies the given callback to every registered cluster. Each cluster is handled independently: a callback that throws (synchronously or asynchronously) for one cluster never prevents the remaining clusters from being processed. |
| [init(cluster)](https://imqueue.org/api/core/latest/core.clustermanager.init/) |  | Registers a cluster's membership callbacks with this manager and returns an identified handle. |
| [remove(cluster, destroy)](https://imqueue.org/api/core/latest/core.clustermanager.remove/) |  | Unregisters a cluster from this manager. |

