RunnerServer.ts
RunnerServer.ts overview
Section titled “RunnerServer.ts overview”Provides server-side layers for the cluster runner protocol.
Runner protocol handlers receive ping, notification, request, stream, and
envelope messages from other runners. They forward those messages into
Sharding and coordinate persisted replies through MessageStorage. This
module includes the handler layer, a transport-independent RPC server layer, a
full server layer that also provides runner clients, and a client-only layer
for applications that do not serve runner RPCs.
Since v4.0.0
Exports Grouped by Category
Section titled “Exports Grouped by Category”layers
Section titled “layers”Creates the runner RPC server layer, which receives messages from other
runners, forwards them to the Sharding layer, and responds to Ping
requests.
When to use
Use when a runner process should accept runner-to-runner protocol messages
over a provided server RpcServer.Protocol.
Gotchas
This layer does not choose or provide the wire transport; provide a
transport-specific RpcServer.Protocol separately.
See
layerHandlersfor the lower-level handler layer used when the RPC server is supplied elsewherelayerWithClientsfor a runner server layer that also provides theShardingandRunnersclientslayerClientOnlyfor embedding a cluster client without serving runner RPCs
Signature
declare const layer: Layer.Layer<never, never, RpcServer.Protocol | Sharding.Sharding | MessageStorage.MessageStorage>Since v4.0.0
layerClientOnly
Section titled “layerClientOnly”Creates a client-only Runners layer.
When to use
Use to embed a cluster client inside another Effect application without registering with the ShardManager or receiving shard assignments.
Signature
declare const layerClientOnly: Layer.Layer< Sharding.Sharding | Runners.Runners, never, MessageStorage.MessageStorage | RunnerStorage.RunnerStorage | ShardingConfig | Runners.RpcClientProtocol>Since v4.0.0
layerHandlers
Section titled “layerHandlers”Layer that handles runner protocol RPCs by forwarding requests to Sharding
and MessageStorage.
Signature
declare const layerHandlers: Layer.Layer< Handler<"Ping"> | Handler<"Notify"> | Handler<"Effect"> | Handler<"Stream"> | Handler<"Envelope">, never, Sharding.Sharding | MessageStorage.MessageStorage>Since v4.0.0
layerWithClients
Section titled “layerWithClients”Layer that provides RunnerServer together with Runners and Sharding
clients.
Signature
declare const layerWithClients: Layer.Layer< Sharding.Sharding | Runners.Runners, never, | RpcServer.Protocol | MessageStorage.MessageStorage | RunnerStorage.RunnerStorage | ShardingConfig | Runners.RpcClientProtocol | RunnerHealth.RunnerHealth>Since v4.0.0