A lightweight, single-package job orchestration framework for asynchronous task execution in microservices. Process batches efficiently with built-in Prometheus metrics, error handling, and pagination support.
- π― Single Dependency - Just
com.taskrunna:taskrunna- no complex module management - π Async by Design -
ListenableFuture/CompletableFuturewith non-blocking execution - π Production Metrics - Built-in Prometheus integration for observability
- π Smart Batch Processing - Handles pagination, retries, and graceful shutdowns
- π οΈ Plug & Play - Minimal setup, maximum functionality
- β‘ High Performance - Multi-threaded execution without blocking main pools
Major dependency updates with significant performance improvements!
- β Kotlin 2.2.0 with K2 compiler - Up to 2x faster compilation!
- β Latest Micrometer 1.14.2 - Enhanced observability and metrics
- β Ktor 3.1.0 - Major version upgrade with better performance
- β Latest Guava 33.4.8 - Performance improvements and stability
- β ktlint 12.1.1 - Latest code style enforcement
- β Dokka V2 - Future-ready documentation generation
- β All dependencies updated to latest stable versions
- β 1.8x faster code highlighting and completion in IDE
Architecture: Single package design for simplicity
- β
Before:
taskrunna-core+taskrunna-batch(complex) - β
Now: Just
taskrunna(simple!) - π― One import, everything included
com.taskrunna:taskrunna - Complete framework in one package:
BatchJobProcessor- Main processing engine with async executionBaseBatchIterator- Abstract pagination iterator for data sourcesBatchJobStats- Execution statistics and monitoringBatchMetrics- Prometheus metrics integration (optional)PrometheusConfig- Easy metrics setup utilities
taskrunna-examples - Working examples and integration guides
Clone and run the working Prometheus metrics example:
git clone https://github.com/thisKK/taskrunna-framework.git
cd taskrunna-framework
./gradlew :taskrunna-examples:run
# Visit http://localhost:8080 for the web interface
# Visit http://localhost:8080/metrics for Prometheus metricsSimple! Just add one dependency:
repositories {
maven {
url = uri("https://maven.pkg.github.com/thisKK/taskrunna-framework")
credentials {
username = "your-github-username"
password = "your-github-token" // Personal access token with read:packages
}
}
}
dependencies {
implementation("com.taskrunna:taskrunna:1.1.2") // Everything included!
}π Authentication: GitHub Packages requires a Personal Access Token with
read:packagespermission.
π Alternative: Build from Source
git clone https://github.com/thisKK/taskrunna-framework.git
cd taskrunna-framework
./gradlew publishToMavenLocal
# Then use in your project:
dependencies {
implementation("com.taskrunna:taskrunna:1.1.2")
}Process orders from database β Send to Kafka:
// Single import - everything included!
import com.taskrunna.batch.*
// 1. Define your data iterator
class OrderIterator : BaseBatchIterator<Order>() {
override fun loadNextBatch(cursor: String, size: Int) =
orderRepository.findPendingOrders(cursor, size)
override fun extractCursorFrom(order: Order) = order.id
}
// 2. Process with async jobs
val processor = BatchJobProcessor(
iterator = OrderIterator(),
submitJob = { order -> sendToKafka(order) }, // Returns ListenableFuture
onSuccess = { order, result -> markProcessed(order.id) },
onFailure = { order, error -> handleError(order, error) }
)
processor.run() // Processes all orders asynchronously!import com.taskrunna.batch.metrics.PrometheusConfig
// Enable Prometheus metrics (optional)
val metrics = PrometheusConfig.createBatchMetrics("order_processor")
val processor = BatchJobProcessor(
iterator = OrderIterator(),
submitJob = { order -> sendToKafka(order) },
metrics = metrics, // Automatic observability!
jobName = "order_processing"
)
processor.run()
// Metrics automatically available at /metrics endpoint!TaskRunna provides comprehensive Prometheus metrics out of the box:
| Metric | Type | Description |
|---|---|---|
{prefix}_jobs_started_total |
Counter | Total batch jobs started |
{prefix}_jobs_completed_total |
Counter | Total batch jobs completed (success/failure) |
{prefix}_job_duration_seconds |
Timer | Time taken for complete jobs |
{prefix}_tasks_submitted_total |
Counter | Total tasks submitted for processing |
{prefix}_tasks_completed_total |
Counter | Total tasks completed (success/failure) |
{prefix}_task_duration_seconds |
Timer | Time taken for individual tasks |
{prefix}_batches_processed_total |
Counter | Total batches processed |
{prefix}_items_processed_total |
Counter | Total items processed across all batches |
All metrics include relevant tags like job_name, result, and error_type for detailed observability.
Run the included example to see these metrics in action:
./gradlew :taskrunna-examples:run
curl http://localhost:8080/metrics | grep order_retryThe example simulates an order retry system processing 50 orders with realistic success/failure patterns.
The included PrometheusMetricsExample demonstrates:
- β HTTP Server with metrics endpoint (Ktor-based)
- β Realistic Batch Processing - Order retry simulation with ~20% failure rate
- β Live Metrics - Real-time Prometheus metrics collection
- β Multi-threaded Execution - Concurrent task processing
- β Production Patterns - Error handling, logging, observability
Available Endpoints:
GET /- Example information and statusGET /metrics- Prometheus metrics (ready for scraping)GET /health- Health check endpoint
Simple & Clean - Just what you need:
taskrunna-framework/
βββ taskrunna/ # π¦ Single Package - Everything included
β βββ BatchJobProcessor # ποΈ Main async processing engine
β βββ BaseBatchIterator # π Pagination & data iteration
β βββ BatchJobStats # π Execution statistics
β βββ metrics/
β βββ BatchMetrics # π Metrics interface
β βββ MicrometerBatchMetrics# π Prometheus integration
β βββ PrometheusConfig # βοΈ Easy setup utilities
βββ taskrunna-examples/ # π― Working Examples
βββ SimpleExample # π Basic usage demo
βββ PrometheusMetricsExample # π Production-ready example
v1.1.2 Benefits: Single import, everything works together seamlessly!
# Install devbox and enter development environment
curl -fsSL https://get.jetpack.io/devbox | bash
devbox shell
# Setup and build
devbox run setup
devbox run build
# Code quality (optional)
devbox run format # Auto-format code
devbox run check # Lint + testSee CONTRIBUTING.md for complete development guidelines and build instructions.
# Run the Prometheus metrics example
./gradlew :taskrunna-examples:run
# In another terminal, monitor metrics in real-time
watch -n 1 "curl -s http://localhost:8080/metrics | grep order_retry"
# Or view specific metrics
curl http://localhost:8080/metrics | grep -E "(tasks_submitted|job_duration)"- PUBLISHING.md - How to publish to GitHub Packages & Maven Central
- METRICS.md - Comprehensive Prometheus metrics guide
- CONTRIBUTING.md - Development setup and guidelines
- DEVBOX.md - Devbox environment quick reference
- Microservices with batch processing needs
- Data pipelines requiring async execution
- Systems needing production-ready observability
- Teams who want simple, powerful tools
If TaskRunna has helped you or your team, consider supporting its development:
Your support helps maintain and improve TaskRunna for the entire community! π
TaskRunna v1.1.2 - One package, endless possibilities! π