CoAkka target
App-owned work
Use it when the capability remains owned by the app or team and may start local, then move to a peer without changing the caller's target.
JVM framework adapters · Java 17 · version 3.3.2
The framework continues to own HTTP, DI/CDI, validation, security, and lifecycle. CoAkka Runtime receives only app-owned work through a target, routes, bounded admission, and a reply or deadletter.
CoAkka target
Use it when the capability remains owned by the app or team and may start local, then move to a peer without changing the caller's target.
HTTP client
Keep HTTP when the endpoint has independent ownership, URL/discovery, status, headers, auth propagation, and governance.
Framework edge
Spring/Quarkus still owns public ingress, transactions, validation, framework security, and the public response.
// Spring Boot
implementation("io.github.phuong-tran.coakka:spring-boot-starter:3.3.2")
// Or Quarkus
implementation("io.github.phuong-tran.coakka:quarkus-extension:3.3.2")runtime:3.3.2; neither creates a second Core.@Component
class CustomerCapabilityHandlers(
private val store: InMemoryCustomerStore,
) {
@CoAkkaHandler("samples.customer.create")
fun create(command: CustomerDraft): MutationResponse {
return store.create(command)
}
}@PostMapping("/api/customers")
@ResponseStatus(HttpStatus.CREATED)
fun create(request: CustomerDraft): MutationResponse {
return runtimeClient.askBlocking(
"samples.customer.create",
request,
MutationResponse::class.java,
"create_customer",
5_000,
)
}The controller remains the public HTTP boundary. The target names a capability; its handler can run locally today and move to a peer later without turning the controller into private-URL management code.
@ApplicationScoped
@CoAkkaHandler("samples.customer.store")
class CustomerCapabilityHandler(
private val store: InMemoryCustomerStore,
) : CoAkkaLocalHandler {
override fun handle(
request: ConnectorEnvelope,
objectMapper: ObjectMapper,
): ConnectorEnvelope {
val command = objectMapper.readValue(
request.payload,
CustomerDraft::class.java,
)
return CoAkkaReplies.json(
request,
"samples.customer.store",
store.create(command),
CustomerPayloads.MUTATION_RESPONSE,
objectMapper,
)
}
}@POST
@Path("/api/customers")
fun create(request: CustomerDraft): MutationResponse {
return coakka.askBlocking(
"samples.customer.store",
request,
CustomerPayloads.CREATE,
MutationResponse::class.java,
"create_customer",
5_000,
)
}CDI still owns the bean graph and app lifecycle; CoAkka Runtime owns delivery to the target and its structured terminal outcome.
Create this two-module Gradle project. Both apps use Java 17 and Kotlin named arguments. Each framework owns HTTP on /verify; the controller/resource calls a same-process CoAkka Runtime target and returns the handler's JSON reply.
pluginManagement {
repositories {
gradlePluginPortal()
mavenCentral()
}
}
rootProject.name = "coakka-portal-framework-checks"
include("spring-app", "quarkus-app")
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
kotlin("jvm") version "2.3.10" apply false
kotlin("plugin.spring") version "2.3.10" apply false
kotlin("plugin.allopen") version "2.3.10" apply false
id("org.springframework.boot") version "3.5.16" apply false
id("io.quarkus") version "3.35.2" apply false
}
allprojects {
repositories { mavenCentral() }
val outputRoot = providers.environmentVariable("COAKKA_PORTAL_BUILD_ROOT").orNull
if (outputRoot != null) {
layout.buildDirectory.set(file(outputRoot).resolve(path.removePrefix(":").ifEmpty { "root" }))
}
}
subprojects {
tasks.withType<KotlinCompile>().configureEach {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_17)
allWarningsAsErrors.set(true)
}
}
}
kotlin.compiler.execution.strategy=in-process
plugins {
kotlin("jvm")
kotlin("plugin.spring")
id("org.springframework.boot")
}
dependencies {
implementation(platform("org.springframework.boot:spring-boot-dependencies:3.5.16"))
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
implementation("io.github.phuong-tran.coakka:spring-boot-starter:3.3.2")
}
kotlin { jvmToolchain(17) }
package portal.spring
import coakka.spring.CoAkkaHandler
import coakka.spring.CoAkkaRuntimeClient
import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.boot.runApplication
import org.springframework.stereotype.Component
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.RestController
private const val target = "portal.spring.echo"
data class EchoRequest(val message: String)
data class EchoReply(val message: String, val handledBy: String)
@Component
class EchoHandler {
@CoAkkaHandler(target)
fun echo(request: EchoRequest): EchoReply {
return EchoReply(message = request.message, handledBy = "spring-handler")
}
}
@RestController
class VerifyController(private val runtimeClient: CoAkkaRuntimeClient) {
@GetMapping("/verify")
fun verify(): EchoReply {
return runtimeClient.askBlocking(
target,
EchoRequest(message = "hello-coakka-runtime"),
EchoReply::class.java,
"portal_spring_check",
2_000,
)
}
}
@SpringBootApplication
class PortalSpringApp
fun main(args: Array<String>) {
runApplication<PortalSpringApp>(*args)
}
server.port=18082
coakka.runtime.system-name=portal-spring
coakka.runtime.node-id=portal-spring-1
coakka.runtime.source-target=portal.spring.http
gradle :spring-app:bootJar
java -jar spring-app/build/libs/spring-app.jarcurl http://127.0.0.1:18082/verifyplugins {
kotlin("jvm")
kotlin("plugin.allopen")
id("io.quarkus")
}
dependencies {
implementation(platform("io.quarkus.platform:quarkus-bom:3.35.2"))
implementation("io.quarkus:quarkus-kotlin")
implementation("io.quarkus:quarkus-arc")
implementation("io.quarkus:quarkus-rest-jackson")
implementation("io.github.phuong-tran.coakka:quarkus-extension:3.3.2")
}
allOpen {
annotation("jakarta.enterprise.context.ApplicationScoped")
annotation("jakarta.ws.rs.Path")
}
kotlin { jvmToolchain(17) }
package portal.quarkus
import coakka.quarkus.CoAkkaHandler
import coakka.quarkus.CoAkkaJsonHandler
import coakka.quarkus.CoAkkaRuntimeClient
import coakka.v2.connector.protocol.ConnectorPayloadFormat
import coakka.v2.connector.protocol.ConnectorPayloadIdentity
import jakarta.enterprise.context.ApplicationScoped
import jakarta.ws.rs.GET
import jakarta.ws.rs.Path
import jakarta.ws.rs.Produces
import jakarta.ws.rs.core.MediaType
private const val target = "portal.quarkus.echo"
data class EchoRequest(val message: String = "")
data class EchoReply(val message: String = "", val handledBy: String = "")
private val requestIdentity = ConnectorPayloadIdentity(
messageType = "portal.quarkus.echo.request.v1",
payloadSchemaVersion = 1,
payloadFormat = ConnectorPayloadFormat.JSON,
)
private val replyIdentity = ConnectorPayloadIdentity(
messageType = "portal.quarkus.echo.reply.v1",
payloadSchemaVersion = 1,
payloadFormat = ConnectorPayloadFormat.JSON,
)
@ApplicationScoped
@CoAkkaHandler(target)
class EchoHandler : CoAkkaJsonHandler<EchoRequest, EchoReply> {
override fun requestType(): Class<EchoRequest> = EchoRequest::class.java
override fun responseIdentity(response: EchoReply): ConnectorPayloadIdentity {
return replyIdentity
}
override fun handlePayload(payload: EchoRequest): EchoReply {
return EchoReply(message = payload.message, handledBy = "quarkus-handler")
}
}
@Path("/verify")
@Produces(MediaType.APPLICATION_JSON)
class VerifyResource(private val runtimeClient: CoAkkaRuntimeClient) {
@GET
fun verify(): EchoReply {
return runtimeClient.askBlocking(
target,
EchoRequest(message = "hello-coakka-runtime"),
requestIdentity,
EchoReply::class.java,
"portal_quarkus_check",
2_000,
)
}
}
quarkus.http.port=18083
coakka.runtime.system-name=portal-quarkus
coakka.runtime.node-id=portal-quarkus-1
coakka.runtime.source-target=portal.quarkus.http
gradle :quarkus-app:quarkusBuild
java -jar quarkus-app/build/quarkus-app/quarkus-run.jarcurl http://127.0.0.1:18083/verifyExpected replies
{"message":"hello-coakka-runtime","handledBy":"spring-handler"}
{"message":"hello-coakka-runtime","handledBy":"quarkus-handler"}Quarkus DTO rule. The small DTOs provide defaults so the application ObjectMapper has an explicit no-argument construction path. A serialization failure inside the handler is not a route miss; preserve the handler cause instead of increasing the request timeout.
coakka.runtime.monitor-enabled=truestartupConfig() instead of reconstructing effective state from properties.