Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

README.md

Worker API

This section covers setting up workers to execute Temporal workflows and activities in Kotlin.

Overview

The Kotlin SDK provides KWorkerFactory and KWorker which automatically enable coroutine support for Kotlin workflows and suspend activities.

Documents

Document Description
Setup KWorkerFactory, KWorker, KotlinPlugin, registration

Quick Reference

Basic Worker Setup

val client = KClient.connect(KClientOptions(target = "localhost:7233"))

// Create worker with workflows and activities at construction time
val worker = KWorker(
    client,
    KWorkerOptions(
        taskQueue = "task-queue",
        workflows = listOf(MyWorkflowImpl::class),
        activities = listOf(MyActivitiesImpl())
    )
)

// Run the worker (blocks until shutdown or fatal error)
worker.run()

Key Components

Component Purpose
KWorker Creates and runs workers with automatic coroutine support
KWorkerOptions Configuration including workflows and activities
KotlinJavaWorkerPlugin Plugin for Java main apps using Kotlin workflows

Related


Next: Worker Setup