This repository demonstrates common Temporal.io design patterns using HotMesh. Each example pattern is authored as a set of unit tests with assertions made against the runtime, showcasing various patterns and use cases. Each test case cleans the database state to ensure consistency and isolation for each run.
- Clone the Repository
git clone https://github.com/hotmeshio/temporal-patterns-typescript.git cd temporal-patterns-typescript
- Install the dependencies
npm install
- Startup Docker
docker compose up
- Exec
npm test
from within Dockernpm test
For detailed explanations of each pattern, see the pattern pages in the HotMesh Temporal Patterns documentation.
- Collation: Demonstrates grouping tasks and merging results across workflow instances.
- Composition: Highlights workflow composition, enabling modular and reusable task sequences.
- Error (Unknown): Handles unexpected errors in workflows with resilience strategies.
- Error (Fatal): Manages workflows with unrecoverable errors, ensuring a safe failure state.
- Everything: A comprehensive test case combining multiple patterns for a full integration scenario.
- Transactional Hook: Implements a hook mechanism for transactional workflow subprocess execution.
- Idempotency: Ensures tasks produce consistent outcomes across retries or repeated executions.
- Interrupt: Demonstrates pausing and resuming workflows based on external events.
- Retry: Shows retry mechanisms for tasks, defining custom retry intervals and strategies.
- Search: Integrates search capabilities within workflows to retrieve relevant data dynamically.
- Signal: Uses signaling to awaken paused workflows from external inputs=.
- Sleep: Demonstrates controlled delays and pausing workflows between tasks.
Visit each pattern’s page to see example code and unit test cases in action.
- SDK Documentation: Detailed documentation and examples of each pattern.
- Download (NPM): Access the HotMesh package on npm.
The examples in this project are licensed under the Apache 2.0 License. See the LICENSE file for more details.
Contributions are welcome! Please follow the contribution guidelines to submit pull requests or open issues.
This project is not affiliated with, endorsed by, or sponsored by Temporal Technologies, Inc. Temporal is a trademark of Temporal Technologies, Inc., and all references to Temporal and related technologies are for educational and demonstration purposes only.