Getting Started

Tasker is a Rails engine that provides workflow orchestration through atomic, retryable steps. This guide introduces the core framework concepts and installation methods.

Core Framework Concepts

Tasks and Steps

  • Tasks represent complete workflows (e.g., "process_order", "sync_data")

  • Steps are atomic units of work within a task (e.g., "validate_cart", "charge_payment")

  • Step Dependencies define execution order through depends_on_step relationships

YAML Configuration

Tasks are defined declaratively in YAML files:

# config/tasker/tasks/ecommerce/order_processing.yaml
name: process_order
namespace_name: ecommerce
version: 1.0.0

step_templates:
  - name: validate_cart
    handler_class: Ecommerce::ValidateCartHandler
  - name: process_payment
    depends_on_step: validate_cart
    handler_class: Ecommerce::ProcessPaymentHandler
    default_retryable: true
  - name: send_confirmation
    depends_on_step: process_payment
    handler_class: Ecommerce::SendConfirmationHandler

Step Handlers

Ruby classes that implement the business logic for each step:

State Management

  • Task States: pending, processing, completed, failed

  • Step States: pending, processing, completed, failed, cancelled

  • Retryable vs Permanent Failures: Different error types trigger different retry behaviors

Event System

Tasker publishes 56 built-in events for observability:

Installation Methods

Quick Demo Installation

For trying Tasker with complete demo workflows:

→ Try the demo workflows

Existing Rails Application

To add Tasker to your existing Rails app:

1. Add to Gemfile

2. Install and Setup

3. Mount the Engine

4. Configure (Optional)

Framework Architecture

Rails Engine Structure

  • Mounts at /tasker in your application

  • Database tables for tasks, steps, and execution tracking

  • SQL functions for high-performance workflow analysis

  • Background jobs for async step execution

Core Components

Task Handler

Manages overall workflow execution:

Step Execution

Steps run through the orchestration engine:

  • Dependency Resolution: Determines which steps can run

  • Parallel Execution: Independent steps run concurrently

  • Error Handling: Retryable vs permanent failure logic

  • State Persistence: Progress saved between executions

SQL Functions

High-performance PostgreSQL functions for:

  • Dependency Analysis: Finding ready-to-run steps

  • State Transitions: Atomic state updates

  • Performance Metrics: Analytics and monitoring

Creating Your First Workflow

1. Generate Task Structure

This creates:

  • Handler class: app/tasks/welcome_user/welcome_user_handler.rb

  • YAML config: config/tasker/tasks/welcome_user/welcome_user.yaml

  • Test file: spec/tasks/welcome_user/welcome_user_handler_spec.rb

2. Define Step Templates

3. Implement Step Handlers

4. Execute the Workflow

Next Steps

Framework Exploration

Real-World Examples

Production Setup


Ready to build reliable workflows? Start with the 5-minute quickstart to see complete examples in action.

Last updated