Task-oriented reference · Swift 3.3.2

Configure CoAkka Runtime for Swift

Start with the smallest ConnectorStartSpec. Open an advanced group only when the workload requires it, then read Core-accepted and effective facts after startup.

Package and lifecyclePackage.swift · RuntimeHost · close()
Dependency
Pin exact SwiftPM tag 3.3.2; do not use a mutable branch for a reproducible lesson.
Swift
Swift 6+; the portal lesson uses a macOS 13 floor.
main.swift
Each episode replaces one entry file; AppScope.swift is the reusable helper.
RuntimeHost
One owner for the app lifecycle, not one per request.
close()
It may throw. Preserve both the primary operation failure and cleanup failure.

Copy the first runnable package.

Startup intentConnectorStartSpec
systemName
Logical system name; keep it stable across the topology.
nodeID
Unique process-instance identity.
strictNoDrop = true
Fail closed instead of silently dropping.
queueCapacity = 0
Delegates normalization and default resolution to Core; the snapshot returns the accepted capacity.
generation = 1
The app's monotonic configuration generation.
cpuPolicy, useIoUring, enableMonitor
nil means omitted; do not mirror Core defaults in connector code.
Routes and networkRuntimeRouteSpec · RuntimeNetworkConfig
.local(target)
An Embedded handler in this process.
.remote(target, host, port)
An exact single endpoint in Swift 3.3.2; host and port must be reachable from the caller.
.embedded()
Opens no listener; the beginner default.
.outboundOnly()
Dials peers without accepting inbound traffic.
.networkNode(...)
Binds a local interface and advertises an address to peers.
Advanced routing
ROUND_ROBIN/WEIGHT/failover belong to the shared topology contract; do not pretend the exact Swift API projects every strategy.

Read shared routing and failover.

Connection and securityTcpConnectionStrategySpec · TcpSecuritySpec
connectionStrategy = nil
Omits the group for Core AUTO/current Multiplexing.
TcpConnectionMode
An explicit mode when a spec is supplied; enum zero does not mean AUTO.
Connection bounds
Maximum connections, requests per connection, and idle timeout are advanced operational bounds.
security = nil
Omits security intent; it does not mean the app verified TLS.
TcpSecuritySpec
Plaintext/TLS/mTLS intent, credential generation/ID, and credential files.
Effective truth
Read startup apply results, tcpConnectionConfig(), tcpSecurityInfo(), and capabilities; bundled Core 3.3 reports public TCP TLS/mTLS unavailable.

Read the connectivity and security contract.

File Lane and Stream LaneIndependent throwing owners
FileLane.openOwned
The exact receiver owner issues the grant; sha256 returns size and digest.
waitTransfer
Blocking; keep it away from the UI/main actor. Success means terminal + succeeded.
StreamLane.openOwned
The publisher issues a single-admission grant.
UnsafeMutableRawBufferPointer
A writable borrowed source buffer; never retain it beyond the callback.
UnsafeRawBufferPointer
A borrowed consumer view; copy before retaining.
close()
Called by the external owner after terminal/forget, never from its own callback.

Read the data-lane contract.

Read Core-accepted and effective statestartupConfig · runtimeConfig · health · stats

Use the source below as Sources/CoAkkaDemo/main.swift beside AppScope.swift.

main.swift · Configuration
import CoAkkaRuntime
import Foundation

let target = "orders.quote"
let runtime = try RuntimeHost.start(
    ConnectorStartSpec(
        systemName: "orders",
        nodeID: "config-swift-1",
        routes: [.local(target)],
        enableMonitor: true
    )
)

try withThrowingCleanup({
    let startup = try runtime.startupConfig()
    let config = try runtime.runtimeConfig()
    print(
        "generation=\(config.appliedGeneration) " +
            "queue_capacity=\(config.queueCapacity) " +
            "strict_no_drop=\(config.strictNoDrop) " +
            "monitor=\(startup.monitorEnabled) " +
            "state=\(config.runtimeState)"
    )
}, cleanup: runtime.close)
Terminal
swift run CoAkkaDemo

Verified output

generation=1 queue_capacity=4096 strict_no_drop=true monitor=true state=started
startupConfig()
Accepted queue, execution, connection, I/O, Monitor, and default groups.
runtimeConfig()
Identity, generation, routes, and runtime state.
runtimeCapabilities()
Feature truth before advanced transport.
health() / stats()
Observed state and counters.

Requested, accepted, effective, observed.