Writing tasks
Writing tasks: Introduction
Tasks are the core of Trigger.dev. They are long-running processes that are triggered by events.
Before digging deeper into the details of writing tasks, you should read the fundamentals of tasks to understand what tasks are and how they work.
Writing tasks
Topic | Description |
---|---|
Logging | View and send logs and traces from your tasks. |
Errors & retrying | How to deal with errors and write reliable tasks. |
Wait | Wait for periods of time or for external events to occur before continuing. |
Concurrency & Queues | Configure what you want to happen when there is more than one run at a time. |
Versioning | How versioning works. |
Machines | Configure the CPU and RAM of the machine your task runs on |
Idempotency | Protect against mutations happening twice. |
Reattempting & Replaying | You can reattempt a task that has failed all of its attempts. You can also replay a task with a new version of your code. |
Notifications | Send realtime notifications from your task that you can subscribe to from your backend or frontend. |
Rollbacks | Rollback code inside a task when errors happen to provide transactional guarantees. |
Using APIs | How to use APIs from within your tasks. |
Trigger filters | Prevent unwanted filters where the payload doesn’t match your filter. |
Middleware | Middleware can wrap the task run function. |
Automated tests | Write automated tests in code. |
Was this page helpful?