-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
DOCSP-42020: queues feedback 5.0 #3222
Merged
rustagir
merged 4 commits into
mongodb:5.0
from
rustagir:DOCSP-42020-queues-feedback-5.0
Dec 2, 2024
+27
−18
Merged
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
@@ -91,16 +101,15 @@ how to handle failed jobs: | |
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 | ||
------------ | ||
|
@@ -124,7 +133,7 @@ application's ``config/queue.php`` file: | |
'batching' => [ | ||
'driver' => 'mongodb', | ||
'database' => 'mongodb', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also for job batching, replace |
||
'collection' => 'job_batches', | ||
'table' => 'job_batches', | ||
], | ||
|
||
The following table describes properties that you can specify to configure | ||
|
@@ -146,13 +155,13 @@ job batching: | |
``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. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace
connection
withdatabase
in the table.