ClusterRouterOptionsBuilder
此内容尚不支持你的语言。
Defined in: src/cluster/router/ClusterRouterOptions.ts:82
Fluent builder for ClusterRouterOptionsType:
const routerOptions = ClusterRouterOptions.create<Command>() .withCluster(cluster) .withRouterType('consistent-hashing') .withRouteePath('/user/worker') .withExtractKey((m) => m.id);ClusterRouter.factory(routerOptions);Extends
Section titled “Extends”OptionsBuilder<ClusterRouterOptionsType<TMessage>>
Type Parameters
Section titled “Type Parameters”TMessage
Section titled “TMessage”TMessage
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new ClusterRouterOptionsBuilder<
TMessage>():ClusterRouterOptionsBuilder<TMessage>
Returns
Section titled “Returns”ClusterRouterOptionsBuilder<TMessage>
Inherited from
Section titled “Inherited from”Methods
Section titled “Methods”build()
Section titled “build()”build():
Partial<T>
Defined in: src/util/OptionsBuilder.ts:51
Snapshot the set fields as an independent Partial<T> (own props only).
Returns
Section titled “Returns”Partial<T>
Inherited from
Section titled “Inherited from”withCluster()
Section titled “withCluster()”withCluster(
cluster):this
Defined in: src/cluster/router/ClusterRouterOptions.ts:89
The cluster the router lives in — drives membership + transport.
Parameters
Section titled “Parameters”cluster
Section titled “cluster”Returns
Section titled “Returns”this
withExtractKey()
Section titled “withExtractKey()”withExtractKey(
extractKey):this
Defined in: src/cluster/router/ClusterRouterOptions.ts:109
Key extractor — required for consistent-hashing, ignored otherwise.
Parameters
Section titled “Parameters”extractKey
Section titled “extractKey”(message) => string
Returns
Section titled “Returns”this
withMailboxDepthRefreshMs()
Section titled “withMailboxDepthRefreshMs()”withMailboxDepthRefreshMs(
mailboxDepthRefreshMs):this
Defined in: src/cluster/router/ClusterRouterOptions.ts:114
Refresh interval for the cached mailbox depths — smallest-mailbox only.
Parameters
Section titled “Parameters”mailboxDepthRefreshMs
Section titled “mailboxDepthRefreshMs”number
Returns
Section titled “Returns”this
withMailboxDepthStaleAfterMs()
Section titled “withMailboxDepthStaleAfterMs()”withMailboxDepthStaleAfterMs(
mailboxDepthStaleAfterMs):this
Defined in: src/cluster/router/ClusterRouterOptions.ts:119
Age at which a cached depth stops counting; 0 disables the expiry.
Parameters
Section titled “Parameters”mailboxDepthStaleAfterMs
Section titled “mailboxDepthStaleAfterMs”number
Returns
Section titled “Returns”this
withRole()
Section titled “withRole()”withRole(
role):this
Defined in: src/cluster/router/ClusterRouterOptions.ts:94
Restrict routees to up-members carrying this role. Omit for “any node”.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”this
withRouteePath()
Section titled “withRouteePath()”withRouteePath(
routeePath):this
Defined in: src/cluster/router/ClusterRouterOptions.ts:104
The path the routee actor lives under on each node — usually /user/<name>.
Parameters
Section titled “Parameters”routeePath
Section titled “routeePath”string
Returns
Section titled “Returns”this
withRouterType()
Section titled “withRouterType()”withRouterType(
routerType):this
Defined in: src/cluster/router/ClusterRouterOptions.ts:99
Routing strategy. See ClusterRouterType.
Parameters
Section titled “Parameters”routerType
Section titled “routerType”Returns
Section titled “Returns”this
create()
Section titled “create()”
staticcreate<TMessage>():ClusterRouterOptionsBuilder<TMessage>
Defined in: src/cluster/router/ClusterRouterOptions.ts:84
Start a fresh builder.
Type Parameters
Section titled “Type Parameters”TMessage
Section titled “TMessage”TMessage
Returns
Section titled “Returns”ClusterRouterOptionsBuilder<TMessage>
