JVM SDK Guide
Use this guide when you are developing the Java and Kotlin SDKs under sdks/jvm.
What this module owns
sdks/jvm is split into two artifacts:
java-clientthe core JVM runtime client, protocol models, registry, and transportskotlin-clientcoroutine-friendly wrappers on top of the Java client
This directory owns:
- Java-side protocol mirror types
- Java websocket and HTTP loop transports
- Kotlin coroutine wrapper ergonomics
- Gradle build, tests, and Maven publication metadata
It does not own:
- protocol source of truth under
packages/protocol - server routing logic under
packages/server - JavaScript, Python, or Rust runtime integration details
Build and test
Use the Gradle project directly:
gradle -p sdks/jvm test
gradle -p sdks/jvm buildWhat they prove:
gradle -p sdks/jvm testvalidates the Java and Kotlin package testsgradle -p sdks/jvm buildproves the jars, sources jars, javadocs jars, and publication wiring still assemble
CI pins Gradle 8.10.2 and Java 17. Keep local validation close to that environment when debugging version-specific issues.
Common development workflow
Typical loop:
- update
java-client/src/main/**for shared runtime behavior - update
kotlin-client/src/main/**only when the Kotlin wrapper surface needs to change - run
gradle -p sdks/jvm test - if artifact metadata or publication wiring changed, run
gradle -p sdks/jvm build
Avoid duplicating runtime logic in both modules. If the fix belongs to client lifecycle, protocol mapping, or transports, it usually belongs in java-client.
Debugging expectations
Start with the narrowest layer:
MdpClient.javalifecycle, register flow, catalog sync, invocation dispatchProtocolCodec.javaJSON field mapping and message decodingWebSocketClientTransport.javawebsocket framing and close handlingHttpLoopClientTransport.javasession bootstrap, polling, and disconnect behaviorKotlinMdpClient.ktcoroutine wrapper behavior and Java interop
When Java tests pass but Kotlin behavior looks wrong, verify the issue is really in the Kotlin wrapper and not in the shared Java client underneath.
Common failure modes
IllegalStateException: MDP client is not connectedregister()orsyncCatalog()ran beforeconnect()- unsupported transport protocol the server URL scheme is not
ws,wss,http, orhttps - Kotlin compile errors around
CompletionStagethe wrapper leaked Java async types instead of usingawait() - transport closes during polling inspect HTTP response codes and payloads before changing the registry or handler code
Release and packaging notes
This SDK is published by the shared v* release workflow.
Local preflight:
gradle -p sdks/jvm test
gradle -p sdks/jvm buildRepository-side publishing expectations live in Polyglot SDK Packages.