Skip to content

Latest commit

 

History

History
65 lines (51 loc) · 3.65 KB

File metadata and controls

65 lines (51 loc) · 3.65 KB

Workflow Class Documentation

Overview

The Workflow class in ChronoForge is the foundational component for defining Temporal workflows using TypeScript. It provides a powerful framework for managing workflow execution, handling signals and queries, applying lifecycle hooks, and processing complex step sequences. This class extends EventEmitter to provide event-based communication within the workflow, enabling robust state management and execution control.

The core philosophy behind the Workflow class is to simplify the development of Temporal workflows by providing a structured, decorator-based approach that abstracts away many of the complexities of workflow definition, execution, and error handling. It enables developers to focus on business logic while the framework handles the intricacies of workflow orchestration.

Key Features

  • Decorator-Based Workflow Definition: A comprehensive set of decorators (@Temporal, @Signal, @Query, etc.) that simplify workflow definition and management.
  • Signal and Query Handling: Built-in support for defining and managing signals and queries using decorators.
  • Lifecycle Hooks: Flexible lifecycle management through @Hook, @Before, and @After decorators.
  • Step-Based Execution: Complex workflow steps with dependencies, conditions, and error handling via the @Step decorator.
  • Action System: Type-safe business logic operations using the @Action decorator.
  • Event-Based Communication: Integrated EventEmitter functionality for event-driven workflow design.
  • Child Workflow Management: Support for creating and managing child workflows.
  • Execution Flow Control: Built-in capabilities to pause, resume, and cancel workflows.
  • Continuation Support: Handling of workflow continuation through the continueAsNew mechanism.
  • Structured Logging: Integrated logging with workflow context information.
  • OpenTelemetry Integration: Built-in tracing for monitoring and debugging workflow execution.
  • Error Handling: Comprehensive error management with retry capabilities.

Table of Contents

  1. Overview

  2. Workflow Decorators

  3. Error Handling and Tracing

  4. Lifecycle Management

  5. Features and Examples

  6. Conclusion