$ open source · GPL-3.0 — need a commercial license? imqueue.com →

Home > @imqueue/core > ClusterManager

ClusterManager class

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. UDPClusterManager is the implementation shipped with the framework.

Signature:

export declare abstract class ClusterManager 

Remarks

Subclasses must implement ClusterManager.destroy() to release their transport, and that implementation must be idempotent — remove() can invoke it more than once.

Constructors

Constructor

Modifiers

Description

(constructor)()

protected

Constructs a new instance of the ClusterManager class

Properties

Property

Modifiers

Type

Description

clusters

protected

InitializedCluster[]

Clusters currently registered with this manager.

Methods

Method

Modifiers

Description

destroy()

abstract

Releases the manager's transport. Implemented by subclasses, and must be safe to call more than once.

forEachCluster(fn)

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)

Registers a cluster's membership callbacks with this manager and returns an identified handle.

remove(cluster, destroy)

Unregisters a cluster from this manager.