CoAkka Runtime · Swift 3.3.2

Cheat sheet CoAkka Runtime · Swift

Tra nhanh package, API shape, outcome và lifecycle; mở bài đầy đủ khi cần failure law.

Version và package

Package.swift
.package(
    url: "https://github.com/phuong-tran/coakka-runtime-swift.git",
    exact: "3.3.2"
)
Connector
3.3.2: Core generation 3.3, connector revision 2.
Toolchain
Swift 6+.
Stable native targets
macOS ARM64, Linux ARM64/x64, Windows x64. Windows ARM64 còn preview/evaluation; không nâng thành stable bằng wording.
Owner
RuntimeHost; close() có thể throw.

Embedded request/reply

Swift
let runtime = try RuntimeHost.startLocal(
    systemName: "orders",
    target: "orders.quote",
    nodeID: "orders-1"
)
try runtime.registerTextHandler("orders.quote") { quantity in quote(quantity) }
let reply = try runtime.askText(
    source: "checkout",
    target: "orders.quote",
    payload: "2",
    timeoutMs: 2_000
)

Mở package chạy đầu tiên.

Outcome và Deadletter

Reply
askText và ask trả terminal response đã correlation.
Deadletter
Match RuntimeError.deadletter(let value); value giữ reason và original envelope facts.
Timeout/cancel
Failure boundary riêng; không chứng minh handler chưa chạy.
OneWay
Không chờ business response nhưng vẫn có admission/observability evidence.
Classification
Switch typed RuntimeError; không parse description.

Peer trực tiếp

Service
network: .networkNode(
    bindHost: "0.0.0.0",
    bindPort: 19_321,
    advertiseHost: "pricing.internal",
    advertisePort: 19_321
)
Caller
routes: [.remote(
    "orders.quote",
    host: "pricing.internal",
    port: 19_321
)],
network: .outboundOnly()

Mở ví dụ hai process.

File Lane và Stream Lane

File sample · Stream sample

Monitor và effective state

enableMonitor: true
Startup intent.
startupConfig()
Core accepted Monitor/default facts.
health() / stats()
Observed runtime state và counters.
runtimeConfig()
Generation, routes và state.
API boundary
Swift 3.3.2 chưa chiếu Monitor wait API; không copy method từ connector khác.

Checklist tích hợp

Mở reference cấu hình Swift.