CoAkka Runtime · JVM 3.3.2
Java + Kotlin/JVM cheat sheet
One connector, two host-language surfaces. Kotlin favors named arguments; Java uses getJava(), CompletableFuture and blocking helpers.
Version, package and build
Maven dependency
<dependency>
<groupId>io.github.phuong-tran.coakka</groupId>
<artifactId>runtime</artifactId>
<version>3.3.2</version>
</dependency>Gradle dependency
implementation("io.github.phuong-tran.coakka:runtime:3.3.2")- Connector
runtime:3.3.2. The first two numbers identify Core generation3.3; the last is the connector revision.- Lesson environment
- JDK 17 and either Maven 3.9+ or Gradle 9.2.1.
- Consumer floor
- Java 8 package compatibility does not require a Java 8 lesson build.
- Native targets in the JAR
- macOS ARM64, Linux ARM64/x64 and Windows ARM64/x64. Support claims still require evidence for the connector + OS + CPU tuple.
- API names
CoAkka.localis Level 1; the exact JVM 3.3.2 Level 2 owner isConnectorOrchestrator.
Embedded request/reply
Kotlin
val runtime = CoAkka.local(
systemName = "orders",
nodeId = "orders-1",
)
runtime.handler(target = "orders.quote") { payload -> quote(payload) }
val reply = runtime.ask(
target = "orders.quote",
payloadUtf8 = "2",
timeoutMs = 2_000,
)
runtime.shutdown()Java uses ConnectorOrchestrator.start, registerTextHandler, runtime.getJava().askTextBlocking, and waits for the shutdown() future. Copy a complete Java or Kotlin sample.
Outcomes, Deadletter and OneWay
- Reply
askTextoraskcompletes with the correlated response.- Deadletter
DeadletterException.deadlettercarries reason, original envelope, generation, resolved endpoint, attempt count and causal failure facts.- Timeout/cancel
- A separate failure boundary. Do not retry side effects without an idempotency contract.
- OneWay
sendOneWayhas no business acknowledgement; admission observability does not turn it into Ask.- Terminal stream
submitRequestplusterminalEventsseparates submission from waiting over the same runtime outcome contract.
Direct peer
Service
network = RuntimeNetworkConfig.networkNode(
bindHost = "0.0.0.0",
bindPort = 19_321,
advertiseHost = "pricing.internal",
advertisePort = 19_321,
)Caller route
network = RuntimeNetworkConfig.outboundOnly(),
routes = listOf(
RuntimeRouteSpec(
target = "orders.quote",
endpoints = listOf(
RuntimeEndpointSpec(
host = "pricing.internal",
port = 19_321,
weight = 1,
),
),
strategy = RuntimeRouteStrategy.SINGLE_OWNER,
),
)CoAkka Runtime does not require Kubernetes; the topology owner supplies generation-stamped route snapshots. Open the two-process example.
File Lane
- Compute
FileLane.sha256(path = source). - The receiver calls
openOwnedandprepareReceiveGrant. - Send the grant over an authenticated control plane; sender calls
submitSend. - Wait for both SEND and RECEIVE terminal receipts; check
completedand result. - Record the outcome, forget both records and close both owners.
Stream Lane
- The publisher calls
openOwnedand issues aStreamPublishGrant. StreamSource.nextwrites into the borrowed destination and returns Frame, WouldBlock or End.- The subscriber uses the grant, a receive window and
StreamConsumer. - Copy data before the callback ends when it must be retained.
- Wait for PUBLISH/SUBSCRIBE terminal receipts, record, forget and close.
- Use pressure snapshots as input to bounded application policy.
Monitor and effective state
RuntimeMonitorOptions(enabled = true)- Startup intent; verify with
monitor.isEnabled(). monitor.snapshot()- Copied latest health and stats.
awaitNext(timeoutMs = ...)- Bounded doorbell wait; null means no signal in the window.
startupConfig()- Core-accepted default groups and construction facts.
runtimeConfig()/networkConfig()- State, generation, routes, queues, network and provenance.
runtimeCapabilities()- Compiled, entitled and effective facts before advanced transport.
Integration checklist
- Choose Maven or Gradle; do not maintain both in a small demo without a reason.
- Keep one runtime owner for the application lifecycle; never create one per request.
- Use
CoAkka.localfor local Level 1 and open Level 2 only for explicit control. - Use named arguments for multi-parameter constructors and calls.
- Close the owner only after operations and callbacks have ended.
- Read capability and effective state before connection modes, TLS/mTLS or tuning.
- File/Stream Lane have independent lifecycles.
- Never retain a borrowed ByteBuffer beyond its callback.