Skip to content

Commit

Permalink
docs(job-schedulers): add getJobScheduler documentation (#2953)
Browse files Browse the repository at this point in the history
  • Loading branch information
roggervalf authored Dec 6, 2024
1 parent 26f578e commit fb871dd
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
4 changes: 4 additions & 0 deletions docs/gitbook/guide/job-schedulers/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,7 @@ All jobs produced by this scheduler will use the given settings. Note that in th
{% hint style="info" %}
Since jobs produced by the Job Scheduler will get a special job ID in order to guarantee that jobs will never be created more often than the given repeat settings, you cannot choose a custom job id. However you can use the job's name if you need to discriminate these jobs from other jobs.
{% endhint %}

## Read more:

- 💡 [Upsert Job Scheduler API Reference](https://api.docs.bullmq.io/classes/v5.Queue.html#upsertJobScheduler)
19 changes: 17 additions & 2 deletions docs/gitbook/guide/job-schedulers/manage-job-schedulers.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ In BullMQ, managing the lifecycle and inventory of job schedulers is crucial for

#### Remove job scheduler

The removeJobScheduler method is designed to delete a specific job scheduler from the queue. This is particularly useful when a scheduled task is no longer needed or if you wish to clean up inactive or obsolete schedulers to optimize resource usage.
The **removeJobScheduler** method is designed to delete a specific job scheduler from the queue. This is particularly useful when a scheduled task is no longer needed or if you wish to clean up inactive or obsolete schedulers to optimize resource usage.

```typescript
// Remove a job scheduler with ID 'scheduler-123'
Expand All @@ -18,7 +18,7 @@ The method will return true if there was a Job Scheduler to remove with the give

#### Get Job Schedulers

The getJobSchedulers method retrieves a list of all configured job schedulers within a specified range. This is invaluable for monitoring and managing multiple job schedulers, especially in systems where jobs are dynamically scheduled and require frequent reviews or adjustments.
The **getJobSchedulers** method retrieves a list of all configured job schedulers within a specified range. This is invaluable for monitoring and managing multiple job schedulers, especially in systems where jobs are dynamically scheduled and require frequent reviews or adjustments.

```typescript
// Retrieve the first 10 job schedulers in ascending order of their next execution time
Expand All @@ -27,3 +27,18 @@ console.log('Current job schedulers:', schedulers);
```

This method can be particularly useful for generating reports or dashboards that provide insights into when jobs are scheduled to run, aiding in system monitoring and troubleshooting.

#### Get Job Scheduler

The **getJobScheduler** method retrieves a job scheduler by id. This is invaluable for inspecting dedicated configurations.

```typescript
const scheduler = await queue.getJobScheduler('test);
console.log('Current job scheduler:', scheduler);
```
## Read more:
- 💡 [Remove Job Scheduler API Reference](https://api.docs.bullmq.io/classes/v5.Queue.html#removeJobScheduler)
- 💡 [Get Job Schedulers API Reference](https://api.docs.bullmq.io/classes/v5.Queue.html#getJobSchedulers)
- 💡 [Get Job Scheduler API Reference](https://api.docs.bullmq.io/classes/v5.Queue.html#getJobScheduler)

0 comments on commit fb871dd

Please sign in to comment.