Caching API Requests With Long-Lived Workflows in Temporal
A Temporal Workflow Execution has no time limit and can be used for long-lived tasks such as caching API requests. In this example, a TypeScript SDK is used to create an API caching workflow for the moneyconvert.net API. The workflow makes one API request per day to get the latest exchange rates for a set of currencies and stores the most recent result without explicit database calls or cron jobs. Temporal Workflows are deterministic, so APIs requests must be made through an Activity that is called from the Workflow. The workflow can also store historical data and use Continue-As-New to restart the workflow from an initial state when needed.
Company
Temporal
Date published
May 26, 2022
Author(s)
Valeri Karpov
Word count
1371
Language
English
Hacker News points
None found.