Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(job-schedulers): add getJobScheduler documentation #2953

Merged
merged 1 commit into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
Loading