In Mergent, each unit of background work is represented by a task. Tasks are created by your application using Mergent’s client libraries (like mergent-js) or the API.

When a task gets created on Mergent, it is added to a queue, which reliably persists tasks until they are ready to be processed by your application. You can set tasks to process immediately, after a delay, or at a specific scheduled_for time.

When a task is ready to be processed, Mergent sends a task request to your application via an HTTP POST request. Each individual task request is automatically logged and stored as an invocation.

In the case where a task request cannot be processed, such as if your application is experiencing downtime, Mergent will attempt to retry the task request according to our retry policy.

Example: Let’s say you have an e-commerce platform and a customer makes a purchase. Sending a confirmation email is important but it isn’t time-sensitive and can be processed outside of the main flow, preventing slowdowns for other users.

In this scenario, you would create a task in Mergent that holds the information about the email and when it’s ready to be processed, Mergent sends a request to your application to send the email.