Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
8b9724a
Kotlin proposal stub
mfateev Dec 27, 2025
b3cb4e5
Kotlin SDK proposal: API and implementation docs
mfateev Dec 29, 2025
57152b1
Kotlin SDK: Add cancellation documentation
mfateev Dec 29, 2025
2f08871
Kotlin SDK: Fix parameter order and rename condition to awaitCondition
mfateev Dec 31, 2025
2153e4c
Kotlin SDK: Fix client API parameter order (options before args)
mfateev Dec 31, 2025
4a10992
Kotlin SDK: Fix signalWithStart parameter order
mfateev Dec 31, 2025
a42eb80
Kotlin SDK: Fix client API parameter order in phase-2.4
mfateev Dec 31, 2025
5b410e0
Delete outdated docs
mfateev Dec 31, 2025
914d0d4
Add KWorkflowClient, KWorkerFactory, and KChildWorkflowHandle to API
mfateev Dec 31, 2025
b46e530
nexus images
mfateev Dec 31, 2025
42610af
Add Java SDK API Parity section to design document
mfateev Jan 2, 2026
956c9a9
Update docs to reflect Phase 2 completion and retry implementation
mfateev Jan 2, 2026
7e2cb86
Update documentation to reflect current implementation status
mfateev Jan 2, 2026
6422b7e
Update docs: KWorker moved to main module
mfateev Jan 4, 2026
164fa22
Update implementation plan with updateWithStart and mocking completion
mfateev Jan 4, 2026
701f306
Update SDK API doc with updateWithStart design
mfateev Jan 4, 2026
b927c06
Document dynamic handler registration APIs in Kotlin SDK
mfateev Jan 4, 2026
516b837
Refactor sdk-api.md into hierarchical documentation structure
mfateev Jan 5, 2026
e25c017
Remove legacy getHeartbeatDetails(): Payloads? from KActivityInfo
mfateev Jan 5, 2026
e6ab5ee
Remove suspendHeartbeat API, keep only heartbeat()
mfateev Jan 5, 2026
234b072
Document Activity API design decisions in api-parity.md
mfateev Jan 5, 2026
94417b5
Fix Null Safety section example in kotlin-idioms.md
mfateev Jan 5, 2026
66e6ee5
Remove @KWorkflowImpl parallel interface pattern from proposal
mfateev Jan 5, 2026
56d8e0c
Use typed activity call in workflow definition example
mfateev Jan 5, 2026
7a2b51f
Use typed activity call in README Quick Start example
mfateev Jan 5, 2026
c70697c
Use typed activity calls in timers-parallel.md examples
mfateev Jan 5, 2026
9152ca6
Rename Next Steps to Related, add linear Next navigation
mfateev Jan 5, 2026
d713d0c
Add Start Review link to README as entry point for linear navigation
mfateev Jan 5, 2026
9ae3ffb
Expand kotlin-idioms.md with suspend functions, concurrency, cancella…
mfateev Jan 5, 2026
917baaa
Improve kotlin-idioms.md flow and content
mfateev Jan 5, 2026
901cf2b
Replace directory links with README.md links
mfateev Jan 5, 2026
37af43d
Remove implementation links from design review documents
mfateev Jan 5, 2026
72d707e
Add activity definition and implementation to Quick Start example
mfateev Jan 5, 2026
1d282d7
Remove Complete Example reference from README
mfateev Jan 5, 2026
5fef37f
Remove Complete Example section from workflows/README.md
mfateev Jan 5, 2026
636edde
Remove implementation note from koptions.md
mfateev Jan 5, 2026
5ab8006
Remove implementation note from activities/definition.md
mfateev Jan 5, 2026
95e7985
Refactor interceptor API to use suspend functions consistently
mfateev Jan 5, 2026
1d0a468
Remove getChildWorkflowHandle - use external workflow handle instead
mfateev Jan 5, 2026
60981f0
Add runId to KChildWorkflowHandle
mfateev Jan 5, 2026
813ae18
Change KChildWorkflowHandle to use suspend getExecution()
mfateev Jan 5, 2026
614b176
Simplify KChildWorkflowHandle: use suspend fun runId() instead of get…
mfateev Jan 5, 2026
f2d2a50
Remove contextPropagators from KContinueAsNewOptions
mfateev Jan 6, 2026
e541eb6
Use Kotlin properties instead of getter methods in API
mfateev Jan 7, 2026
71000b3
Fix client documentation consistency
mfateev Jan 7, 2026
8411e2e
Remove stale interceptor references from registration example
mfateev Jan 7, 2026
c336312
Simplify activity implementation - remove @KActivityImpl
mfateev Jan 7, 2026
ba584ce
Fix heartbeatDetails API - use reified generic and consistent naming
mfateev Jan 7, 2026
011eae2
Move KActivity API from local-activities.md to implementation.md
mfateev Jan 7, 2026
e259002
Show suspend method support in local activities example
mfateev Jan 7, 2026
08bc977
Remove 'When to Use Local Activities' - assumes Temporal knowledge
mfateev Jan 7, 2026
a35e497
Document KActivity.context availability for local activities
mfateev Jan 7, 2026
9f492c2
Add KActivity.context limitations table to local-activities.md
mfateev Jan 7, 2026
75878d6
Make SignalWithStart and UpdateWithStart consistent
mfateev Jan 7, 2026
553d34b
Change KWithStartWorkflowOperation from class to interface
mfateev Jan 7, 2026
b70eac1
Simplify with-start API and use KSuspendFunction consistently
mfateev Jan 7, 2026
8638229
Clean up worker setup documentation
mfateev Jan 7, 2026
2a727c8
Use idiomatic Kotlin naming in API parity doc
mfateev Jan 7, 2026
3a7ac10
Update Kotlin SDK spec based on gap validation analysis
mfateev Jan 7, 2026
eaaec83
Add testing documentation and navigation fixes
mfateev Jan 12, 2026
f95b7bf
Kotlin SDK API Proposal
mfateev Jan 12, 2026
9603691
Expand migration guide with comprehensive API mapping
mfateev Jan 12, 2026
dfb633e
Expand migration guide with comprehensive API mapping
mfateev Jan 12, 2026
8273a67
Add interfaceless workflow/activity proposal as open question
mfateev Jan 12, 2026
c86195b
Add open questions document and cross-link discussions
mfateev Jan 12, 2026
c5c1e1e
Add Claude instructions with open questions guidance
mfateev Jan 12, 2026
e1c6c05
Add KArgs type-safe activity arguments as open question
mfateev Jan 12, 2026
fcaaa01
Add 0-arg versions and child workflow/client examples to KArgs proposal
mfateev Jan 12, 2026
de7cbad
Add three options for type-safe activity/workflow arguments
mfateev Jan 12, 2026
a45e8de
Add data classes vs builder+DSL open question
mfateev Jan 12, 2026
d63d702
Update Kotlin SDK proposal with API refinements and open questions
mfateev Jan 12, 2026
c978a16
Document that default parameter values are not allowed
mfateev Jan 13, 2026
f967a07
Merge default params documentation from PR branch
mfateev Jan 13, 2026
a98bf12
Rename KActivityContext to KActivityExecutionContext, remove logger
mfateev Jan 13, 2026
4306ffa
Remove heartbeatDetails from KActivityInfo (use KActivityExecutionCon…
mfateev Jan 13, 2026
fb99a76
Fix KLocalActivityOptions to match Java LocalActivityOptions
mfateev Jan 13, 2026
99b668e
Update Kotlin SDK API docs based on PR review decisions
mfateev Jan 13, 2026
8ae3077
Remove .idea and .claude directories from tracking
mfateev Jan 13, 2026
3828995
Remove CLAUDE.md from tracking
mfateev Jan 13, 2026
c6370b1
Add enhanced nested DSL ergonomics suggestion to open-questions
mfateev Jan 13, 2026
43c7014
Update API proposal based on PR review round 2
mfateev Jan 14, 2026
dbfc512
Address PR review round 2 comments
mfateev Jan 14, 2026
edf8cbf
Address PR review comments Q20-Q24
mfateev Jan 15, 2026
8d3d46f
Add run() method to KWorker API
mfateev Jan 16, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.idea/
.claude/
*.iml
CLAUDE.md
134 changes: 134 additions & 0 deletions kotlin/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
# Kotlin SDK API Proposal

This document describes the public API and developer experience for the Temporal Kotlin SDK.

## Overview

The Kotlin SDK provides an idiomatic Kotlin experience for building Temporal workflows using coroutines and suspend functions.

**Key Features:**

* Coroutine-based workflows with `suspend fun`
* Full interoperability with Java SDK
* Kotlin Duration support (`30.seconds`)
* DSL builders for configuration
* Null safety (no `Optional<T>`)

**Requirements:**

* Minimum Kotlin version: 1.8.x
* Coroutines library: kotlinx-coroutines-core 1.7.x+

## Design Principle

**Use idiomatic Kotlin language patterns wherever possible instead of custom APIs.**

The Kotlin SDK should feel natural to Kotlin developers by leveraging standard `kotlinx.coroutines` primitives. Custom APIs should only be introduced when Temporal-specific semantics cannot be achieved through standard patterns.

| Pattern | Standard Kotlin | Temporal Integration |
|---------|-----------------|----------------------|
| Parallel execution | `coroutineScope { async { ... } }` | Works via deterministic dispatcher |
| Await multiple | `awaitAll(d1, d2)` | Standard kotlinx.coroutines |
| Sleep/delay | `delay(duration)` | Intercepted via `Delay` interface |
| Deferred results | `Deferred<T>` | Standard + `Promise<T>.toDeferred()` |

This approach provides:
- **Familiar patterns**: Kotlin developers use patterns they already know
- **IDE support**: Full autocomplete and documentation for standard APIs
- **Ecosystem compatibility**: Works with existing coroutine libraries and utilities
- **Smaller API surface**: Less custom code to learn and maintain

## Documentation Structure

### Core Concepts

- **[Kotlin Idioms](./kotlin-idioms.md)** - Duration, null safety, property syntax for queries
- **[Configuration](./configuration/README.md)** - KOptions classes, data conversion, interceptors

### Building Blocks

- **[Workflows](./workflows/README.md)** - Defining and implementing workflows
- [Definition](./workflows/definition.md) - Interfaces, suspend methods, Java interop
- [Signals, Queries & Updates](./workflows/signals-queries.md) - Communication patterns
- [Child Workflows](./workflows/child-workflows.md) - Orchestrating child workflows
- [Timers & Parallel Execution](./workflows/timers-parallel.md) - Delays, async patterns
- [Cancellation](./workflows/cancellation.md) - Handling cancellation, cleanup
- [Continue-As-New](./workflows/continue-as-new.md) - Long-running workflow patterns

- **[Activities](./activities/README.md)** - Defining and implementing activities
- [Definition](./activities/definition.md) - Interfaces, typed/string-based execution
- [Implementation](./activities/implementation.md) - Suspend activities, heartbeating
- [Local Activities](./activities/local-activities.md) - Short-lived local activities

### Infrastructure

- **[Client](./client/README.md)** - Interacting with workflows
- [Workflow Client](./client/workflow-client.md) - KClient, starting workflows
- [Workflow Handles](./client/workflow-handle.md) - Signals, queries, results
- [Advanced Operations](./client/advanced.md) - SignalWithStart, UpdateWithStart

- **[Worker](./worker/README.md)** - Running workflows and activities
- [Setup](./worker/setup.md) - KWorkerFactory, KWorker, registration

### Reference

- **[Testing](./testing.md)** - Unit testing, mocking activities, time skipping
- **[Migration Guide](./migration.md)** - Migrating from Java SDK
- **[API Parity](./api-parity.md)** - Java SDK comparison, gaps, not-needed APIs
- **[Open Questions](./open-questions.md)** - API design decisions pending discussion

## Quick Start

```kotlin
// Define activity interface - @ActivityMethod is optional
@ActivityInterface
interface GreetingActivities {
suspend fun composeGreeting(greeting: String, name: String): String
}

// Implement activity
class GreetingActivitiesImpl : GreetingActivities {
override suspend fun composeGreeting(greeting: String, name: String): String {
return "$greeting, $name!"
}
}

// Define workflow interface - @WorkflowMethod is optional
@WorkflowInterface
interface GreetingWorkflow {
suspend fun getGreeting(name: String): String
}

// Implement workflow
class GreetingWorkflowImpl : GreetingWorkflow {
override suspend fun getGreeting(name: String): String {
return KWorkflow.executeActivity(
GreetingActivities::composeGreeting,
KActivityOptions(startToCloseTimeout = 10.seconds),
"Hello", name
)
}
}

// Start worker - workflows and activities specified in options
val worker = KWorker(
client,
KWorkerOptions(
taskQueue = "greetings",
workflows = listOf(GreetingWorkflowImpl::class),
activities = listOf(GreetingActivitiesImpl())
)
)
worker.start()

// Execute workflow
val result = client.executeWorkflow(
GreetingWorkflow::getGreeting,
KWorkflowOptions(workflowId = "greeting-123", taskQueue = "greetings"),
"Temporal"
)
```

---

**[Start Review →](./kotlin-idioms.md)**
77 changes: 77 additions & 0 deletions kotlin/activities/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# Activities

This section covers defining and implementing Temporal activities in Kotlin.

## Overview

Activities are the building blocks for interacting with external systems. The Kotlin SDK provides type-safe activity execution with suspend function support.

## Documents

| Document | Description |
|----------|-------------|
| [Definition](./definition.md) | Activity interfaces, typed and string-based execution |
| [Implementation](./implementation.md) | Implementing activities, KActivity API, heartbeating |
| [Local Activities](./local-activities.md) | Short-lived local activities |

## Quick Reference

### Basic Activity

```kotlin
// Define activity interface - @ActivityMethod is optional
@ActivityInterface
interface GreetingActivities {
suspend fun composeGreeting(greeting: String, name: String): String
}

// Use @ActivityMethod only when customizing the activity name
@ActivityInterface
interface CustomNameActivities {
@ActivityMethod(name = "compose-greeting")
suspend fun composeGreeting(greeting: String, name: String): String
}

// Implement activity
class GreetingActivitiesImpl : GreetingActivities {
override suspend fun composeGreeting(greeting: String, name: String): String {
return "$greeting, $name!"
}
}
```

### Calling Activities from Workflows

```kotlin
// Type-safe method reference
val greeting = KWorkflow.executeActivity(
GreetingActivities::composeGreeting,
KActivityOptions(startToCloseTimeout = 30.seconds),
"Hello", "World"
)

// String-based (for cross-language interop)
val result = KWorkflow.executeActivity<String>(
"composeGreeting",
KActivityOptions(startToCloseTimeout = 30.seconds),
"Hello", "World"
)
```

### Key Patterns

| Pattern | API |
|---------|-----|
| Execute activity | `KWorkflow.executeActivity(Interface::method, options, args)` |
| Execute by name | `KWorkflow.executeActivity<R>("name", options, args)` |
| Local activity | `KWorkflow.executeLocalActivity(Interface::method, options, args)` |
| Heartbeat | `KActivity.executionContext.heartbeat(details)` |

## Related

- [Implementation](./implementation.md) - Suspend activity patterns
- [Local Activities](./local-activities.md) - Short-lived activities

---

**Next:** [Activity Definition](./definition.md)
Loading