Skip to main content

Java SDK

The Java SDK for writing TaskDaemon handlers.

Installation

Add io.github.jona62:handler:0.1.2 from Maven Central to your application. The SDK requires Java 17 or later; Java package imports remain com.taskdaemon.

Maven

Gradle

Source build alternative

For a local source build from the same release:
Gradle users choosing this local source build must add mavenLocal() before mavenCentral() in repositories. For source-based Docker builds, install this pinned SDK in the builder before packaging your application. Keep diagnostic logs on stderr; the handler protocol uses stdout for one response per task. A request starts with attempt: 1; retries require a valid retryable error and remaining stored budget.

Basic Usage

Task Record

Result Types

Usage:

Complete Example

Error Handling

Exceptions are automatically caught and converted to non-retryable errors:
For explicit error handling:

Dockerfile

Save the complete example as src/main/java/WordCountHandler.java. Use this application pom.xml to compile for Java 17:
The Dockerfile runs WordCountHandler with the SDK and its runtime dependencies from Maven Central:
Change the main class to match your application, including its package name. GraalVM native builds require application-specific build configuration and Jackson reflection metadata; validate that build before substituting a native executable.

Handler Configuration

Requirements

  • Java 17+ (uses records and sealed interfaces)
  • Jackson for JSON serialization (included in SDK)