-
Notifications
You must be signed in to change notification settings - Fork 1.4k
PHPORM-81 implement mongodb
driver for batch
#2904
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
Changes from 12 commits
9933b78
6df5604
408cf08
556cd39
f882b29
a711c4d
4a30370
d2b4942
8dbdbd3
c542ed8
212a8cc
c02c7ca
b912ce7
5cfed4b
d0fd299
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -11,7 +11,7 @@ Queues | |||||
.. meta:: | ||||||
:keywords: php framework, odm, code example | ||||||
|
||||||
If you want to use MongoDB as your database backend for Laravel Queue, change | ||||||
If you want to use MongoDB as your database backend for Laravel Queue, change | ||||||
the driver in ``config/queue.php``: | ||||||
|
||||||
.. code-block:: php | ||||||
|
@@ -20,27 +20,107 @@ the driver in ``config/queue.php``: | |||||
'database' => [ | ||||||
'driver' => 'mongodb', | ||||||
// You can also specify your jobs specific database created on config/database.php | ||||||
'connection' => 'mongodb-job', | ||||||
'table' => 'jobs', | ||||||
'connection' => 'mongodb', | ||||||
'collection' => 'jobs', | ||||||
'queue' => 'default', | ||||||
'expire' => 60, | ||||||
], | ||||||
], | ||||||
|
||||||
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. S: add an introductory sentence before the table, such as: |
||||||
If you want to use MongoDB to handle failed jobs, change the database in | ||||||
.. list-table:: | ||||||
:header-rows: 1 | ||||||
:widths: 25 75 | ||||||
|
||||||
* - Setting | ||||||
- Description | ||||||
|
||||||
* - ``driver`` | ||||||
- **Required**. Specifies the queue driver to use. Must be ``mongodb``. | ||||||
|
||||||
* - ``connection`` | ||||||
- Uses the default connection by default. The database connection used to store jobs. It must be a ``mongodb`` connection. | ||||||
GromNaN marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
* - ``collection`` | ||||||
- **Required**. Name of the MongoDB collection to store jobs to process. | ||||||
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.
Suggested change
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. Applies to all entries |
||||||
|
||||||
* - ``queue`` | ||||||
- **Required**. Name of the queue. | ||||||
|
||||||
* - ``retry_after`` | ||||||
- Default ``60``. Specify how many seconds the queue connection should wait before retrying a job that is being processed | ||||||
GromNaN marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
If you want to use MongoDB to handle failed jobs, change the database in | ||||||
``config/queue.php``: | ||||||
|
||||||
.. code-block:: php | ||||||
|
||||||
'failed' => [ | ||||||
'driver' => 'mongodb', | ||||||
// You can also specify your jobs specific database created on config/database.php | ||||||
'database' => 'mongodb-job', | ||||||
'table' => 'failed_jobs', | ||||||
'database' => 'mongodb', | ||||||
'collection' => 'failed_jobs', | ||||||
], | ||||||
|
||||||
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. S: same as earlier, add an introductory sentence to introduce this table |
||||||
.. list-table:: | ||||||
:header-rows: 1 | ||||||
:widths: 25 75 | ||||||
|
||||||
* - Setting | ||||||
- Description | ||||||
|
||||||
* - ``driver`` | ||||||
- **Required**. Specifies the queue driver to use. Must be ``mongodb``. | ||||||
|
||||||
* - ``connection`` | ||||||
- Uses the default connection by default. The database connection used to store jobs. It must be a ``mongodb`` connection. | ||||||
GromNaN marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
* - ``collection`` | ||||||
- Default ``failed_jobs``. Name of the MongoDB collection to store failed jobs. | ||||||
GromNaN marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
|
||||||
Add the service provider in ``config/app.php``: | ||||||
|
||||||
.. code-block:: php | ||||||
|
||||||
MongoDB\Laravel\MongoDBQueueServiceProvider::class, | ||||||
|
||||||
|
||||||
Job Batching | ||||||
------------ | ||||||
|
||||||
`Job batching https://laravel.com/docs/{+laravel-docs-version+}/queues#job-batching>`__ | ||||||
GromNaN marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
is a Laravel feature to execute batch of jobs and subsequent actions before, | ||||||
GromNaN marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
after and during the execution of the jobs from the queue. | ||||||
GromNaN marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
With MongoDB, you don't have to create any collection before using this feature. | ||||||
GromNaN marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
The collection ``job_batches`` will be created automatically to store meta | ||||||
GromNaN marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
information about your job batches, such as their completion percentage. | ||||||
|
||||||
.. code-block:: php | ||||||
|
||||||
'batching' => [ | ||||||
'driver' => 'mongodb', | ||||||
'database' => 'mongodb', | ||||||
'collection' => 'job_batches', | ||||||
], | ||||||
|
||||||
.. list-table:: | ||||||
:header-rows: 1 | ||||||
:widths: 25 75 | ||||||
|
||||||
* - Setting | ||||||
- Description | ||||||
|
||||||
* - ``driver`` | ||||||
- **Required**. Specifies the queue driver to use. Must be ``mongodb``. | ||||||
|
||||||
* - ``connection`` | ||||||
- Uses the default connection by default. The database connection used to store jobs. It must be a ``mongodb`` connection. | ||||||
GromNaN marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
* - ``collection`` | ||||||
- Default ``job_batches``. Name of the MongoDB collection to store job batches. | ||||||
GromNaN marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
Add the service provider in ``config/app.php``: | ||||||
|
||||||
.. code-block:: php | ||||||
|
||||||
MongoDB\Laravel\MongoDBBusServiceProvider::class, |
Uh oh!
There was an error while loading. Please reload this page.