Ir al contenido
Español

ClusterRouterOptionsType

Esta página aún no está disponible en tu idioma.

ClusterRouterOptionsType<TMessage> = object

Defined in: src/cluster/router/ClusterRouterOptions.ts:7

Plain options-object shape consumed by ClusterRouter.factory.

TMessage

readonly cluster: Cluster

Defined in: src/cluster/router/ClusterRouterOptions.ts:9

The cluster the router lives in. Used for membership + transport.


readonly optional extractKey?: (message) => string

Defined in: src/cluster/router/ClusterRouterOptions.ts:27

Required for routerType: 'consistent-hashing', ignored otherwise. Returns the string key used to pin a message to a routee. Two messages with the same key always land on the same node (subject to the cluster topology not changing).

TMessage

string


readonly optional mailboxDepthRefreshMs?: number

Defined in: src/cluster/router/ClusterRouterOptions.ts:39

How often, in milliseconds, the router refreshes its cached view of every routee node’s mailbox depth. Read only for routerType: 'smallest-mailbox'; ignored otherwise.

This is the lag on the router’s picture of the cluster, and the rate at which it costs one small envelope per routee. Shorter tracks a fast-moving load more closely and talks more; longer is cheaper and routes on an older view. Defaults to DEFAULT_MAILBOX_DEPTH_REFRESH_MS.


readonly optional mailboxDepthStaleAfterMs?: number

Defined in: src/cluster/router/ClusterRouterOptions.ts:50

How long, in milliseconds, a cached depth stays usable. A routee whose last reading is older is skipped as though it had never answered, so the router routes on silence the way it would on a cold cache — round-robin order — instead of on a number from before a node went quiet.

0 turns the expiry off: a reading is then used however old it is. Read only for routerType: 'smallest-mailbox'. Defaults to DEFAULT_MAILBOX_DEPTH_STALE_AFTER_MS.


readonly optional role?: string

Defined in: src/cluster/router/ClusterRouterOptions.ts:11

Restrict routees to up-members carrying this role. Omit for “any node”.


readonly routeePath: string

Defined in: src/cluster/router/ClusterRouterOptions.ts:20

The path the routee actor lives under on each routee node — usually /user/<actorName>. The same path must exist on every targeted node; the router doesn’t probe for liveness beyond the cluster membership state.


readonly routerType: ClusterRouterType

Defined in: src/cluster/router/ClusterRouterOptions.ts:13

Strategy. See ClusterRouterType.