Skip to content

Commit 512c610

Browse files
authored
DOCSP-39849: revise job batching docs (#2994)
* DOCSP-39849: revise job batching docs * JT fixes * small fixes * NR PR fixes 1
1 parent 3415f86 commit 512c610

File tree

1 file changed

+60
-28
lines changed

1 file changed

+60
-28
lines changed

docs/queues.txt

+60-28
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,29 @@ Queues
99
:values: tutorial
1010

1111
.. meta::
12-
:keywords: php framework, odm, code example
12+
:keywords: php framework, odm, code example, jobs
1313

14-
If you want to use MongoDB as your database backend for Laravel Queue, change
15-
the driver in ``config/queue.php``:
14+
To use MongoDB as your database for Laravel Queue, change
15+
the driver in your application's ``config/queue.php`` file:
1616

1717
.. code-block:: php
1818

1919
'connections' => [
2020
'database' => [
2121
'driver' => 'mongodb',
22-
// You can also specify your jobs specific database created on config/database.php
22+
// You can also specify your jobs-specific database
23+
// in the config/database.php file
2324
'connection' => 'mongodb',
2425
'collection' => 'jobs',
2526
'queue' => 'default',
26-
'retry_after' => 60,
27+
// Optional setting
28+
// 'retry_after' => 60,
2729
],
2830
],
2931

32+
The following table describes properties that you can specify to configure
33+
the behavior of the queue:
34+
3035
.. list-table::
3136
:header-rows: 1
3237
:widths: 25 75
@@ -35,22 +40,29 @@ the driver in ``config/queue.php``:
3540
- Description
3641

3742
* - ``driver``
38-
- **Required**. Specifies the queue driver to use. Must be ``mongodb``.
43+
- **Required** Queue driver to use. The value of
44+
this property must be ``mongodb``.
3945

4046
* - ``connection``
41-
- The database connection used to store jobs. It must be a ``mongodb`` connection. The driver uses the default connection if a connection is not specified.
47+
- Database connection used to store jobs. It must be a
48+
``mongodb`` connection. The driver uses the default connection if
49+
a connection is not specified.
4250

4351
* - ``collection``
44-
- **Required**. Name of the MongoDB collection to store jobs to process.
52+
- **Required** Name of the MongoDB collection to
53+
store jobs to process.
4554

4655
* - ``queue``
47-
- **Required**. Name of the queue.
56+
- **Required** Name of the queue.
4857

4958
* - ``retry_after``
50-
- Specifies how many seconds the queue connection should wait before retrying a job that is being processed. Defaults to ``60``.
59+
- Specifies how many seconds the queue connection should wait
60+
before retrying a job that is being processed. The value is
61+
``60`` by default.
5162

52-
If you want to use MongoDB to handle failed jobs, change the database in
53-
``config/queue.php``:
63+
To use MongoDB to handle failed jobs, create a ``failed`` entry in your
64+
application's ``config/queue.php`` file and specify the database and
65+
collection:
5466

5567
.. code-block:: php
5668

@@ -60,6 +72,9 @@ If you want to use MongoDB to handle failed jobs, change the database in
6072
'collection' => 'failed_jobs',
6173
],
6274

75+
The following table describes properties that you can specify to configure
76+
how to handle failed jobs:
77+
6378
.. list-table::
6479
:header-rows: 1
6580
:widths: 25 75
@@ -68,32 +83,41 @@ If you want to use MongoDB to handle failed jobs, change the database in
6883
- Description
6984

7085
* - ``driver``
71-
- **Required**. Specifies the queue driver to use. Must be ``mongodb``.
86+
- **Required** Queue driver to use. The value of
87+
this property must be ``mongodb``.
7288

7389
* - ``connection``
74-
- The database connection used to store jobs. It must be a ``mongodb`` connection. The driver uses the default connection if a connection is not specified.
90+
- Database connection used to store jobs. It must be
91+
a ``mongodb`` connection. The driver uses the default connection
92+
if a connection is not specified.
7593

7694
* - ``collection``
77-
- Name of the MongoDB collection to store failed jobs. Defaults to ``failed_jobs``.
78-
95+
- Name of the MongoDB collection to store failed
96+
jobs. The value is ``failed_jobs`` by default.
7997

80-
Add the service provider in ``config/app.php``:
98+
Then, add the service provider in your application's
99+
``config/app.php`` file:
81100

82101
.. code-block:: php
83102

84103
MongoDB\Laravel\MongoDBQueueServiceProvider::class,
85104

86-
87105
Job Batching
88106
------------
89107

90-
`Job batching <https://laravel.com/docs/{+laravel-docs-version+}/queues#job-batching>`__
91-
is a Laravel feature to execute a batch of jobs and subsequent actions before,
92-
after, and during the execution of the jobs from the queue.
108+
**Job batching** is a Laravel feature that enables you to execute a
109+
batch of jobs and related actions before, after, and during the
110+
execution of the jobs from the queue. To learn more about this feature,
111+
see `Job Batching <https://laravel.com/docs/{+laravel-docs-version+}/queues#job-batching>`__
112+
in the Laravel documentation.
113+
114+
In MongoDB, you don't have to create a designated collection before
115+
using job batching. The ``job_batches`` collection is created
116+
automatically to store metadata about your job batches, such as
117+
their completion percentage.
93118

94-
With MongoDB, you don't have to create any collection before using job batching.
95-
The ``job_batches`` collection is created automatically to store meta
96-
information about your job batches, such as their completion percentage.
119+
To enable job batching, create the ``batching`` entry in your
120+
application's ``config/queue.php`` file:
97121

98122
.. code-block:: php
99123

@@ -103,6 +127,9 @@ information about your job batches, such as their completion percentage.
103127
'collection' => 'job_batches',
104128
],
105129

130+
The following table describes properties that you can specify to configure
131+
job batching:
132+
106133
.. list-table::
107134
:header-rows: 1
108135
:widths: 25 75
@@ -111,15 +138,20 @@ information about your job batches, such as their completion percentage.
111138
- Description
112139

113140
* - ``driver``
114-
- **Required**. Specifies the queue driver to use. Must be ``mongodb``.
141+
- **Required** Queue driver to use. The value of
142+
this property must be ``mongodb``.
115143

116144
* - ``connection``
117-
- The database connection used to store jobs. It must be a ``mongodb`` connection. The driver uses the default connection if a connection is not specified.
145+
- Database connection used to store jobs. It must be a
146+
``mongodb`` connection. The driver uses the default connection if
147+
a connection is not specified.
118148

119149
* - ``collection``
120-
- Name of the MongoDB collection to store job batches. Defaults to ``job_batches``.
150+
- Name of the MongoDB collection to store job
151+
batches. The value is ``job_batches`` by default.
121152

122-
Add the service provider in ``config/app.php``:
153+
Then, add the service provider in your application's ``config/app.php``
154+
file:
123155

124156
.. code-block:: php
125157

0 commit comments

Comments
 (0)