Skip to content

Commit

Permalink
DOCSP-42020: queues feedback 5.0 (#3222)
Browse files Browse the repository at this point in the history
* DOCSP-42020: queues feedback

(cherry picked from commit 830ba9f)

* DOCSP-42020: queues feedback - 5.0+

* JS small fix

* replace cxn with db in tables
  • Loading branch information
rustagir authored Dec 2, 2024
1 parent 7459a54 commit bd9c0a8
Showing 1 changed file with 27 additions and 18 deletions.
45 changes: 27 additions & 18 deletions docs/queues.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@ Queues
.. meta::
:keywords: php framework, odm, code example, jobs

Overview
--------

In this guide, you can learn how to use MongoDB as your database for
Laravel Queue. Laravel Queue allows you to create queued jobs that are
processed in the background.

Configuration
-------------

To use MongoDB as your database for Laravel Queue, change
the driver in your application's ``config/queue.php`` file:

Expand All @@ -22,7 +32,7 @@ the driver in your application's ``config/queue.php`` file:
// You can also specify your jobs-specific database
// in the config/database.php file
'connection' => 'mongodb',
'collection' => 'jobs',
'table' => 'jobs',
'queue' => 'default',
// Optional setting
// 'retry_after' => 60,
Expand All @@ -48,7 +58,7 @@ the behavior of the queue:
``mongodb`` connection. The driver uses the default connection if
a connection is not specified.

* - ``collection``
* - ``table``
- **Required** Name of the MongoDB collection to
store jobs to process.

Expand All @@ -60,7 +70,7 @@ the behavior of the queue:
before retrying a job that is being processed. The value is
``60`` by default.

To use MongoDB to handle failed jobs, create a ``failed`` entry in your
To use MongoDB to handle *failed jobs*, create a ``failed`` entry in your
application's ``config/queue.php`` file and specify the database and
collection:

Expand All @@ -69,7 +79,7 @@ collection:
'failed' => [
'driver' => 'mongodb',
'database' => 'mongodb',
'collection' => 'failed_jobs',
'table' => 'failed_jobs',
],

The following table describes properties that you can specify to configure
Expand All @@ -86,21 +96,20 @@ how to handle failed jobs:
- **Required** Queue driver to use. The value of
this property must be ``mongodb``.

* - ``connection``
* - ``database``
- Database connection used to store jobs. It must be
a ``mongodb`` connection. The driver uses the default connection
if a connection is not specified.

* - ``collection``
* - ``table``
- Name of the MongoDB collection to store failed
jobs. The value is ``failed_jobs`` by default.

Then, add the service provider in your application's
``config/app.php`` file:

.. code-block:: php

MongoDB\Laravel\MongoDBQueueServiceProvider::class,
To register failed jobs, you can use the default failed
job provider from Laravel. To learn more, see
`Dealing With Failed Jobs
<https://laravel.com/docs/{+laravel-docs-version+}/queues#dealing-with-failed-jobs>`__ in
the Laravel documentation on Queues.

Job Batching
------------
Expand All @@ -124,7 +133,7 @@ application's ``config/queue.php`` file:
'batching' => [
'driver' => 'mongodb',
'database' => 'mongodb',
'collection' => 'job_batches',
'table' => 'job_batches',
],

The following table describes properties that you can specify to configure
Expand All @@ -141,18 +150,18 @@ job batching:
- **Required** Queue driver to use. The value of
this property must be ``mongodb``.

* - ``connection``
* - ``database``
- Database connection used to store jobs. It must be a
``mongodb`` connection. The driver uses the default connection if
a connection is not specified.

* - ``collection``
* - ``table``
- Name of the MongoDB collection to store job
batches. The value is ``job_batches`` by default.

Then, add the service provider in your application's ``config/app.php``
file:

.. code-block:: php

MongoDB\Laravel\MongoDBBusServiceProvider::class,
The {+odm-short+} automatically provides the
``MongoDB\Laravel\MongoDBBusServiceProvider::class`` class as the
service provider for job batching.

0 comments on commit bd9c0a8

Please sign in to comment.