CoAkka Runtime · Node.js 3.3.2
CoAkka Runtime · Node.js cheat sheet
Find the task, copy the short pattern, then open the verified full file when lifecycle or failure handling matters.
Version and package
Terminal
npm install [email protected]- Connector
[email protected]; Node.js 22+; ESM imports from the package root.- Core generation
3.3. The first two connector numbers identify the Core generation; the last is the connector revision.- Native identity
- Commit
f9e5a632d2d046a5b4e89d5ce0c9042aee5c7b45, ABI 1 in the verified package. - Package targets
- macOS ARM64, Linux ARM64/x64 and Windows ARM64/x64. Read support as connector version + OS + CPU + evidence; do not infer beyond the tuple.
Embedded request/reply
Pattern
const runtime = RuntimeHost.start({
systemName: "orders",
nodeId: "orders-1",
routes: [localRoute("orders.quote")],
});
try {
runtime.registerPayloadHandler("orders.quote", quote);
const reply = await runtime.askPayload("checkout", "orders.quote", payload, 2000);
} finally {
await runtime.close();
}Omit network to preserve Core's Embedded default. Open the complete first-run file.
Outcomes, deadletters and OneWay
- Reply
askPayload,askJsonoraskTypedresolves with a correlated terminal response.- Deadletter
DeadletterError.deadlettercarries reason, original envelope, generation, endpoint attempts and failure facts. Do not parse error text.- Timeout/cancel
- A separate failure boundary. Do not retry side effects without an idempotency contract.
- OneWay
sendOneWayTyped/sendOneWayJsonhas no business reply. Admission observability does not turn it into request/reply.- Terminal stream
submitRequest...+terminalEvents()separates submit from await over the same runtime contract.
Direct peer
Service
network: networkNode("0.0.0.0", 19321, "pricing.internal", 19321),
routes: [localRoute("orders.quote")],Caller route
network: outboundOnlyNetwork(),
routes: [{
target: "orders.quote",
strategy: RouteStrategy.SINGLE_OWNER,
endpoints: [{ host: "pricing.internal", port: 19321, weight: 1, flags: 0 }],
}],Bind is where the listener opens; advertise is what the peer can reach. A topology owner supplies generation-based snapshots. CoAkka Runtime does not claim automatic service discovery or Kubernetes membership.
Open the full two-process example · Look up failover and retry
File Lane
- Compute
FileLane.sha256(sourcePath). - The receiver calls
openOwnedandprepareReceiveGrant. - Move the grant through a trusted control plane; the sender calls
submitSend(grant.toSendSpec(...)). - Wait for terminal
SENDandRECEIVErecords and checkcompletedplus result. - Record outcomes, forget both records, then
await close().
Copy the runnable example · Look up bounds, security and failures
Stream Lane
- The publisher calls
openOwned, bounds frames and prepares a synchronous source. - The subscriber uses the grant, a receive window and a synchronous consumer.
- Copy
datainside the callback before retaining it. - Wait for terminal PUBLISH/SUBSCRIBE records, check results, forget and close.
- Use pressure snapshots as app-policy input; do not turn them into an unbounded retry loop.
Copy the runnable example · Look up flow control and pressure
Monitor and effective state
enableMonitor: true- Enables extra collection before startup. Confirm with
runtime.monitor.isEnabled(). runtime.monitor.snapshot()- Copied health and stats at the read point.
awaitNext(timeoutMs)- A deadline-bounded Promise for a refresh signal; null only means no signal in the window.
runtimeStartupConfig()- Applied startup defaults, provenance and accepted facts.
runtimeConfig()/runtimeNetworkConfig()- Actual generation, routes, overload, bind and network participation.
runtimeSnapshot()- A combined diagnostic view. Never log secrets or transfer tokens with it.
Integration checklist
- One active
RuntimeHostper Node.js process; create it at startup, not per request. - The application owns handlers and business authorization; Core owns routing, transport, bounds and outcome facts.
- Finish operations and Monitor waits before
await runtime.close(). - Keep package installation separate from runtime configuration; pin the connector and verify its platform tuple.
- Read capabilities and effective state before connection-mode, TLS/mTLS or tuning changes.
- File Lane and Stream Lane are independent owners; close them even when no
RuntimeHostexists.