From bd9c0a80e57732bd819721b5648b5d66fc5363be Mon Sep 17 00:00:00 2001 From: Rea Rustagi <85902999+rustagir@users.noreply.github.com> Date: Mon, 2 Dec 2024 10:08:36 -0500 Subject: [PATCH] DOCSP-42020: queues feedback 5.0 (#3222) * DOCSP-42020: queues feedback (cherry picked from commit 830ba9f2ab00f637c30e1f2526ea4b18ddc4ab0c) * DOCSP-42020: queues feedback - 5.0+ * JS small fix * replace cxn with db in tables --- docs/queues.txt | 45 +++++++++++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 18 deletions(-) diff --git a/docs/queues.txt b/docs/queues.txt index 5e25d868b..951853084 100644 --- a/docs/queues.txt +++ b/docs/queues.txt @@ -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: @@ -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, @@ -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. @@ -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: @@ -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 @@ -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 +`__ in +the Laravel documentation on Queues. Job Batching ------------ @@ -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 @@ -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.