Skip to content

Latest commit

 

History

History
70 lines (47 loc) · 1.68 KB

architecture.md

File metadata and controls

70 lines (47 loc) · 1.68 KB

Architecture

Core Components

Executor Interface

The primary interface for implementing custom strategies:

type Executor interface {
    Execute(ctx context.Context, req *entity.ExecuteTaskReq) (*entity.ExecuteTaskResp, error)
}

Runtime Components

  • Temporal Scheduler: Manages schedule creation and trigger handling
  • Activity Executor: Handles strategy execution and lifecycle management
  • State Manager: Maintains execution state and handles persistence
  • Error Handler: Implements retry mechanisms and failure recovery

Implementation Requirements

Strategy Development

  1. Implement the Executor interface
  2. Process incoming ExecuteTaskReq
  3. Return execution results via ExecuteTaskResp

System Integration

  • Strategies are automatically registered with Temporal
  • Schedules are created based on subscription configurations
  • Execution is triggered according to defined intervals

Managed Components

Scheduling

  • Schedule creation and management
  • Trigger processing and distribution
  • Execution window management

Execution

  • Activity lifecycle management
  • State persistence
  • Error handling and retries
  • Result processing

Resource Management

  • Workload distribution
  • Execution throttling
  • Resource allocation

Design Considerations

Strategy Implementation

  • Implement atomic, single-responsibility strategies
  • Utilize provided context for execution control
  • Handle edge cases within strategy implementation
  • Return structured responses via ExecuteTaskResp

Performance

  • Strategies are executed as Temporal activities
  • Built-in support for parallel execution
  • Automatic resource scaling