CoAkka Runtime · Node.js 3.3.2

Configure CoAkka Runtime with Node.js

Choose the task you are doing. Beginner can stop at Embedded and defaults. Open network, route, TLS or data-lane settings only when the deployment needs them. Read Core-accepted values instead of reconstructing effective state from input.

What are you configuring?

Environment and packageNode.js 22+ · npm
node --version
Node.js 22 or newer is required. Releases are also gated on the current Node.js LTS line.
npm install [email protected]
Installs the exact connector used in this lesson, including native payloads for published targets.
.mjs
Uses ESM and imports through the package root. Do not deep-import internal transport modules.
COAKKA_RUNTIME_LIB
An explicit native-library diagnostic override. Normal package use does not need it; any override must match the connector.
Start the hostRuntimeHost.start(startSpec)
systemName
The stable logical system name.
nodeId
A unique instance ID in that system. One Node.js process may keep one active host.
routes
The initial route snapshot. localRoute(target) is the in-process helper.
generation
The route snapshot generation. Omission starts with a valid generation; later updates must be newer.
network
Omit it to let Core select Embedded. Use an explicit helper when the lesson needs to show topology.
queueCapacity
A queue bound. Omit it for Core's default and tune only with pressure evidence.
strictNoDrop
Requests explicit refusal rather than a permitted drop policy. Read it back through runtimeStartupConfig().
enableMonitor
true enables extra collection, false is explicit disable intent, and omission preserves Core's default.
separateDeliveredRequestLane
The default is shaped for request/reply. Override only for a measured one-way host.
overloadPolicy
Advanced ingress/local/remote policy. Omit the group to retain Core-owned defaults.
connectionStrategy / security
Advanced transport groups. Omit the entire group so zero does not accidentally become explicit intent.
Bytes-first callaskPayload(source, target, payload, timeoutMs?, deliveryHint?)
source
The caller's logical name, such as checkout.
target
The work address matching a route and handler, such as orders.quote.
payload
A Uint8Array or Buffer. Both application sides own the byte schema and encoding.
timeoutMs
The call deadline in milliseconds. The lesson uses 2000; choose the application contract.
deliveryHint
Omit it or use DeliveryHint.ROUTER_DEFAULT to follow the route. Other hints constrain delivery; they are not retry policy.
DeadletterError
A structured terminal failure. Read reason, envelope, generation and failure facts; do not parse the message.
Network participationembeddedNetwork · outboundOnlyNetwork · networkNode
embeddedNetwork()
Opens no listener; caller and handler remain in one process. Start here.
outboundOnlyNetwork()
Connects to peers without accepting peer requests.
networkNode(bindHost, bindPort, advertiseHost, advertisePort?)
Opens a local listener and advertises a peer-reachable endpoint.
bindHost / bindPort
The socket actually opened on the host.
advertiseHost / advertisePort
The endpoint placed in peer routes. Loopback is not reachable across two machines.

Choose direct peers, edge or Kubernetes · Understand shared connectivity

Routes and endpointsRouteSpec · EndpointSpec
target
The capability name being resolved.
endpoints
Candidate owners, each with host, port, weight and flags.
RouteStrategy.SINGLE_OWNER
Exactly one owner endpoint in the snapshot.
WEIGHTED_ROUND_ROBIN
Distributes work by weight across available endpoints.
RENDEZVOUS_HASH
Selects a stable endpoint from a route key; routeKeyHint names the header containing it.
weight
Endpoint weight for a weighted strategy; it is not a retry count.
EndpointFlag.LOCAL
The endpoint belongs to this process; UNAVAILABLE removes it from new work.
flags
Route and endpoint flags are contract bitsets. Use exported enums; do not invent meanings for numbers.

Look up routing, ROUND_ROBIN, WEIGHT and the full checklist.

Connections and securityRuntimeTcpConnectionStrategySpec · RuntimeTcpSecuritySpec
Omitted connectionStrategy
Preserves Core's MULTIPLEXING default. An object with mode: 0 is explicit PER_EXCHANGE intent.
mode
PER_EXCHANGE, BOUNDED_POOL, PERSISTENT_SINGLE_FLIGHT or MULTIPLEXING; check capabilities first.
maxConnections
Bounds connections where the selected mode and capability support tuning.
maxRequestsPerConnection
Retires a connection after a bounded number of requests.
idleTimeoutMs
Bounds idle connection retention.
security.mode
PLAINTEXT, TLS or MUTUAL_TLS according to the trust boundary and capabilities.
credentialGeneration
A nonzero, increasing generation for each new credential set.
credentialId
A non-secret diagnostic ID; never place keys or tokens here.
caCertificateFile
The trusted CA PEM used to verify the peer.
identityCertificateFile / privateKeyFile
The instance certificate chain and matching private key. Never log key material.
reloadMode
How existing connections are handled when a newer credential generation is applied.

Look up defaults and validation · Look up TLS/mTLS and checklists

File Lane and Stream LaneResources independent from RuntimeHost
FileLane.openOwned
An exact-owner receiver can issue a FileReceiveGrant pinned to instance, address, port and transfer.
FileLane.sha256
Computes exact size and SHA-256 before prepare.
waitTransfer
Waits from the last update sequence. Success requires terminal SEND and RECEIVE records.
StreamLane.openOwned
An exact-owner publisher issues a StreamPublishGrant for one session.
maxFrameBytes / initialWindowBytes
Bound frames and receive credit; the window must fit at least one frame.
source / consumer
Synchronous, bounded callbacks. Views live only for the callback; copy before retaining.
forget / close
Record terminal outcomes, forget retained records, then await owner close.

Look up shared lifecycle, pressure, security and outcomes.

Read Core-accepted configurationruntimeStartupConfig · runtimeConfig · runtimeNetworkConfig

Create configuration.mjs in the lesson project, paste the file and run it. Queue 64, strict-no-drop, Embedded and Monitor are explicit only to distinguish requested and accepted state.

configuration.mjs
import { RuntimeHost, embeddedNetwork, localRoute } from "coakka-runtime-node";

const runtime = RuntimeHost.start({
  systemName: "configuration-lab",
  nodeId: "configuration-lab-1",
  routes: [localRoute("orders.quote")],
  network: embeddedNetwork(),
  strictNoDrop: true,
  queueCapacity: 64,
  enableMonitor: true,
});

try {
  const startup = runtime.runtimeStartupConfig();
  const active = runtime.runtimeConfig();
  const network = runtime.runtimeNetworkConfig();
  console.log(
    `generation=${active.appliedGeneration} queue_capacity=${startup.queueCapacity} ` +
      `strict_no_drop=${startup.strictNoDrop} monitor=${startup.monitorEnabled} ` +
      `network_mode=${network.mode}`,
  );
} finally {
  await runtime.close();
}
Terminal
node configuration.mjs

Verified output

generation=1 queue_capacity=64 strict_no_drop=true monitor=true network_mode=1
runtimeStartupConfig()
Applied startup defaults, queue, CPU/I/O, connection, delivery and Monitor state.
runtimeConfig()
Generation, route count, runtime state, bind and effective overload policy.
runtimeNetworkConfig()
Network mode, explicit/default provenance and bind/advertise state.
runtimeCapabilities()
Compiled, entitled and effective feature bits before advanced transport changes.
health() / stats()
Current copied health and counters.
runtimeSnapshot()
A combined runtime, startup, network, connector, health and stats diagnostic view.

Compare requested, accepted, effective and observed state.