Mergent offers two main constructs to manage your background jobs: tasks and schedules. Although they are used to accomplish similar goals, their usage and functionality are quite different.
Think of a task as a single unit of work. You can create tasks when certain events occur in your application - a user making a purchase, signing up for your newsletter, and so on. Once such a task is created, Mergent adds it to a queue and ensures it’s reliably processed by your application.
Tasks are ideal for one-off, asynchronous jobs that need to be done outside the main application flow.
Schedules represent recurring work that needs to be done at regular intervals. These intervals can be defined by a cron expression or an rrule, giving you the flexibility to schedule tasks as often as needed - be it every minute, daily, or even every third Tuesday of the month.
When a schedule is triggered, it creates a task, just like any other task you’d manually create. Mergent then sends this task to your application for processing.
Schedules are perfect for tasks that occur regularly, like sending out weekly newsletters, generating monthly reports, or performing daily data clean-up.
Tasks vs. Schedules
|Frequency||Individual, one-off jobs.||Recurring jobs, as often as needed (minute, daily, specific weekdays, etc.).|
|Functionality||Once created, the task is added to a queue and Mergent ensures it’s reliably processed by your application.||When triggered, the schedule creates a task which is then processed by your application.|
|Time Options||1. Immediately when queued|
2. After a
3. At a specific
|Recurring based on the provided |
|Failures & Retries||Automatically handles failures and retries.||Schedules themselves don’t handle failures, but the tasks they create do.|
Get started with your first task & schedule in minutes
How Tasks Work
Learn more about tasks for one-off asynchronous workloads
How Schedules Work
Learn more about schedules and how they create tasks
Learn more about the syntax used with Cron schedules
Learn more about the syntax used with RRule schedules