Skip to content

Commit

Permalink
docs: add new api references
Browse files Browse the repository at this point in the history
  • Loading branch information
roggervalf committed Jun 30, 2022
1 parent 868bb00 commit bd64c46
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 16 deletions.
4 changes: 2 additions & 2 deletions docs/gitbook/guide/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description: >-

# Architecture

In order to use the full potential of Bull queues, it is important to understand the lifecycle of a job. From the moment a producer calls the [`add`](../api/bullmq.queue.add.md) method on a queue instance, a job enters a lifecycle where it will be in different states, until its completion or failure (although technically a failed job could be retried and get a new lifecycle).
In order to use the full potential of Bull queues, it is important to understand the lifecycle of a job. From the moment a producer calls the [`add`](https://api.docs.bullmq.io/classes/Queue.html#add) method on a queue instance, a job enters a lifecycle where it will be in different states, until its completion or failure (although technically a failed job could be retried and get a new lifecycle).

![Lifecycle of a job - Queue](<../.gitbook/assets/architecture (1).png>)

Expand Down Expand Up @@ -34,7 +34,7 @@ When a job is added to a queue it can be in one of two states, it can either be

The next state for a job is the “active” state. The active state is represented by a set, and are jobs that are currently being processed, i.e. they are running in the `process` function explained in the previous chapter. A job can be in the active state for an unlimited amount of time until the process is completed or an exception is thrown so that the job will end in either the “completed” or the “failed” status.

Another way to add a job is by the [`add`](https://github.com/taskforcesh/bullmq/blob/master/docs/gitbook/api/bullmq.flowproducer.add.md) method on a flow producer instance.
Another way to add a job is by the [`add`](https://api.docs.bullmq.io/classes/FlowProducer.html#add) method on a flow producer instance.

![Lifecycle of a job - Flow Producer](../.gitbook/assets/flow-architecture.png)

Expand Down
8 changes: 4 additions & 4 deletions docs/gitbook/guide/flows/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ This functionality enables the creation of flows where jobs are the node of tree
Flows are added to a queue using the "_FlowProducer_" class.
{% endhint %}

In order to create "flows" you must use the [FlowProducer](https://api.docs.bullmq.io/classes/FlowProducer.html) class. The method "_add_" accepts an object with the following interface:
In order to create "flows" you must use the [FlowProducer](https://api.docs.bullmq.io/classes/FlowProducer.html) class. The method [_**add**_](https://api.docs.bullmq.io/classes/FlowProducer.html#add) accepts an object with the following interface:

```typescript
interface FlowJob {
Expand Down Expand Up @@ -193,6 +193,6 @@ await queue.remove(job.id);

## Read more:

* 📋 [Divide large jobs using flows](https://blog.taskforce.sh/splitting-heavy-jobs-using-bullmq-flows/)
* 💡 [FlowProducer API Reference](https://api.docs.bullmq.io/classes/FlowProducer.html)
* 💡 [Job API Reference](https://api.docs.bullmq.io/classes/Job.html)
- 📋 [Divide large jobs using flows](https://blog.taskforce.sh/splitting-heavy-jobs-using-bullmq-flows/)
- 💡 [FlowProducer API Reference](https://api.docs.bullmq.io/classes/FlowProducer.html)
- 💡 [Job API Reference](https://api.docs.bullmq.io/classes/Job.html)
4 changes: 2 additions & 2 deletions docs/gitbook/guide/jobs/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Jobs

Queues can hold different types of jobs which determine how and when they are processed. In this section we will describe them in detail.
Queues can hold different types of jobs which determine how and when they are processed. In this section, we will describe them in detail.

An important thing to consider is that you can mix the different job types in the same queue, so you can add FIFO jobs, and at any moment add a LIFO or a delayed job.

## Read more:

- 💡 [Job API Reference](https://github.com/taskforcesh/bullmq/blob/master/docs/gitbook/api/bullmq.job.md)
- 💡 [Job API Reference](https://api.docs.bullmq.io/classes/Job.html)
3 changes: 1 addition & 2 deletions docs/gitbook/guide/jobs/fifo.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ description: 'First-In, First-Out'
The first type of jobs we are going to describe is the FIFO \(First-In, First-Out\) type. This is the standard type when adding jobs to a queue. The jobs are processed in the order they are inserted into the queue. This order is preserved independently on the amount of processors you have; however, if you have more than one worker or concurrency larger than 1, even though the workers will start the jobs in order, they may be completed in a slightly different order, since some jobs may take more time to complete than others.

```typescript
import { Queue } from 'bullmq'
import { Queue } from 'bullmq';

const myQueue = new Queue('Paint');

Expand Down Expand Up @@ -36,4 +36,3 @@ const queue = new Queue('Paint', { defaultJobOptions: {
removeOnComplete: true, removeOnFail: 1000
});
```
5 changes: 1 addition & 4 deletions docs/gitbook/guide/workers/graceful-shutdown.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,4 @@ In order to perform a shutdown just call the _**close**_ method:
await worker.close();
```

The above call will mark the worker as _closing_ so it will not pick up new jobs, at the same time it will wait for all the current jobs to be processed \(or failed\). This call will not timeout by itself, so you should make sure that your jobs finalize in a timely maner. If this call fails for some reason or it is not able to complete, the pending jobs will be marked as stalled and processed by other workers \(if correct stalled options are configured on the [QueueScheduler](https://github.com/taskforcesh/bullmq/blob/3a8873b6453405e6f8e57331f6cee30977406670/docs/gitbook/api/bullmq.queuescheduleroptions.md)\).



The above call will mark the worker as _closing_ so it will not pick up new jobs, at the same time it will wait for all the current jobs to be processed \(or failed\). This call will not timeout by itself, so you should make sure that your jobs finalize in a timely manner. If this call fails for some reason or it is not able to complete, the pending jobs will be marked as stalled and processed by other workers \(if correct stalled options are configured on the [QueueScheduler](https://api.docs.bullmq.io/interfaces/QueueSchedulerOptions.html)\).
3 changes: 1 addition & 2 deletions docs/gitbook/guide/workers/pausing-queues.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

BullMQ supports pausing queues globally or locally. A queue is paused globally when no workers will pick up any jobs from the queue. When you pause a queue, the workers that are currently busy processing a job, will continue working on that job until it completes (or failed), and then will just keep idling until the queue has been unpaused.

Pausing a queue is performed by calling the _**pause**_ method on a [queue](../../api/bullmq.queue.md) instance:
Pausing a queue is performed by calling the _**pause**_ method on a [queue](https://api.docs.bullmq.io/classes/Queue.html) instance:

```typescript
await myQueue.pause();
Expand All @@ -19,4 +19,3 @@ The call above will wait for all the jobs currently being processed by this work
```typescript
await myWorker.pause(true);
```

0 comments on commit bd64c46

Please sign in to comment.