Core Concepts
Understanding Tasker's architecture and key components
This guide explains the fundamental concepts that make Tasker a powerful workflow orchestration engine. Understanding these concepts will help you design better workflows and debug issues more effectively.
Architecture Overview
Tasker is built around six main components that work together to provide reliable workflow orchestration:
1. Task Handlers
Workflow orchestration and step coordination
Purpose: Define the structure, dependencies, and configuration of multi-step workflows.
Key Responsibilities:
Define step sequences and dependencies
Validate input context
Register with the handler registry
Configure retry policies and timeouts
Modern Architecture (Tasker Engine v0.1.0)
Primary Pattern: ConfiguredTask with YAML
Alternative Pattern: Direct Registration
Key Features
Step Dependencies: Steps execute only after their dependencies complete
Parallel Execution: Independent steps run simultaneously
Error Handling Configuration: Different retry strategies per step
2. Step Handlers
Individual step business logic implementation
Purpose: Implement the actual business logic for each workflow step.
Key Responsibilities:
Execute business operations
Handle errors appropriately
Return results for dependent steps
Maintain idempotency
Basic Structure
Error Handling Patterns
Retryable vs Permanent Failures: Tasker determines retry behavior based on step configuration and error types.
Temporary Failures (will retry based on step configuration):
Permanent Failures (fail immediately):
Step Configuration Controls Retry Behavior:
Result Passing
Step results are automatically persisted and available to dependent steps:
3. Workflow Orchestration
SQL-powered step coordination
Purpose: Coordinate step execution based on dependencies while maintaining high performance and reliability.
Dependency Resolution
Tasker uses PostgreSQL functions for sub-millisecond dependency resolution:
Execution Patterns
Linear Workflow: Sequential step execution
Parallel Workflow: Independent concurrent execution
Diamond Pattern: Fan-out then fan-in
Complex Dependencies: Multiple prerequisite steps
4. Event System
Observability and integration capabilities
Purpose: Provide real-time visibility into workflow execution and enable integrations with external systems.
Event Types
Tasker publishes events throughout the workflow lifecycle:
Event Structure
Each event contains comprehensive context information:
Event Subscribers
Create custom integrations by subscribing to events:
5. Enterprise Features
Production-ready capabilities
Purpose: Provide enterprise-grade features for production workflow orchestration at scale.
Thread-Safe Registry Operations
Production-ready concurrent task execution with automatic safety:
Structured Logging with Correlation IDs
Automatic request tracing across distributed operations:
OpenTelemetry Integration
Enterprise observability with automatic tracing and metrics:
REST API & GraphQL
Built-in API access for integration and monitoring:
Advanced Event System
56+ built-in events with structured data for comprehensive observability:
6. Namespace & Versioning
Enterprise-scale organization
Purpose: Organize workflows by business domain and enable safe evolution through semantic versioning.
Namespace Organization
Organize workflows by business capability:
Semantic Versioning
Multiple versions can coexist safely:
Version Selection
Choose versions explicitly when running workflows:
7. Handler Registry
Discovery and loading system
Purpose: Automatically discover, load, and manage workflow handlers with thread-safe operations.
Automatic Discovery
Tasker automatically discovers handlers in your application:
Thread-Safe Operations
The registry handles concurrent access safely:
Registry Introspection
Inspect the registry for debugging and discovery:
Key Design Principles
1. Reliability First
Automatic retry with exponential backoff
Distinction between temporary and permanent failures
SQL-based orchestration for consistency
Comprehensive error handling
2. Observability Built-In
Complete event system for monitoring
Structured logging with correlation IDs
Performance metrics and tracing
Health endpoints for production
3. Developer Experience
Clear separation of concerns
Rails generators for rapid development
Comprehensive test infrastructure
Rich debugging tools
4. Enterprise Ready
Namespace organization for large teams
Semantic versioning for safe evolution
Thread-safe concurrent operations
Production-grade authentication
5. Performance Optimized
SQL functions for critical path operations
Minimal overhead for simple workflows
Efficient dependency resolution
Optimized database queries
Understanding Workflow Lifecycle
1. Definition Phase
Write task handlers and step handlers
Configure dependencies and retry policies
Define input/output schemas
Register with the handler registry
2. Execution Phase
Validate input context against schema
Create workflow step sequence
Execute steps based on dependencies
Handle errors and retries automatically
3. Monitoring Phase
Publish events for each state change
Update step status and results
Track performance metrics
Provide real-time visibility
4. Completion Phase
Mark workflow as completed or failed
Trigger completion events
Clean up resources
Generate final reports
Next Steps
Now that you understand the core concepts:
Quick Start Guide - Build your first workflow
Developer Guide - Comprehensive implementation
Workflow Patterns - Common design patterns
Real Examples - See concepts in action
These concepts form the foundation for building reliable, observable, and maintainable workflows that scale from simple automation to enterprise-grade business processes.
Last updated