Skip to content

Commit 4fb93f6

Browse files
authored
Merge pull request #34 from cakephp/docs
Docs
2 parents 25f623a + ca999f5 commit 4fb93f6

File tree

2 files changed

+26
-15
lines changed

2 files changed

+26
-15
lines changed

docs/en/index.rst

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ the ``Application::bootstrap()`` function::
3535
Configuration
3636
=============
3737

38-
The following configuration should be present in your **config/app.php**::
38+
The following configuration should be present in the config array of your **config/app.php**::
3939

40-
$config = [
40+
// ...
4141
'Queue' => [
4242
'default' => [
4343
// A DSN for your configured backend. default: null
@@ -53,8 +53,8 @@ The following configuration should be present in your **config/app.php**::
5353
// The name of an event listener class to associate with the worker
5454
'listener' => \App\Listener\WorkerListener::class,
5555
]
56-
]
57-
];
56+
],
57+
// ...
5858

5959
The ``Queue`` config key can contain one or more queue configurations. Each of
6060
these is used for interacting with a different queuing backend.
@@ -69,6 +69,8 @@ Create a Job class::
6969

7070
<?php
7171
// src/Job/ExampleJob.php
72+
declare(strict_types=1);
73+
7274
namespace App\Job;
7375

7476
use Cake\Log\LogTrait;
@@ -182,6 +184,8 @@ mailer class. The following example shows how to setup the trait within a mailer
182184
class::
183185

184186
<?php
187+
declare(strict_types=1);
188+
185189
namespace App\Mailer;
186190

187191
use Cake\Mailer\Mailer;
@@ -191,7 +195,7 @@ class::
191195
{
192196
use QueueTrait;
193197

194-
public function welcome($emailAddress, $username)
198+
public function welcome(string $emailAddress, string $username): void
195199
{
196200
$this
197201
->setTo($emailAddress)
@@ -218,14 +222,7 @@ a ``Processor:ACK``.
218222
The exposed ``QueueTrait::push()`` method has a similar signature to
219223
``Mailer::send()``, and also supports an ``$options`` array argument. The
220224
options this array holds are the same options as those available for
221-
``QueueManager::push()``, and additionally supports the following:
222-
223-
- ``emailClass``:
224-
225-
- default: ``Cake\Mailer\Email::class``
226-
- description: The name of an email class to instantiate for use with the mailer
227-
- type: string
228-
225+
``QueueManager::push()``.
229226

230227
Run the worker
231228
==============

src/QueueManager.php

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,22 @@ public static function engine(string $name): SimpleClient
155155
* to a statically callable function. When an array is used, the
156156
* class will be constructed by Queue\Processor and have the
157157
* named method invoked.
158-
* @param array $args An array of data to set for the job
159-
* @param array $options An array of options for publishing the job
158+
* @param array $args An array of data to set for the job.
159+
* @param array $options An array of options for publishing the job:
160+
* - `config` - A queue config name. Defaults to 'default'.
161+
* - `delay` - Time (in integer seconds) to delay message, after which it
162+
* will be processed. Not all message brokers accept this. Default `null`.
163+
* - `expires` - Time (in integer seconds) after which the message expires.
164+
* The message will be removed from the queue if this time is exceeded
165+
* and it has not been consumed. Default `null`.
166+
* - `priority` - Valid values:
167+
* - `\Enqueue\Client\MessagePriority::VERY_LOW`
168+
* - `\Enqueue\Client\MessagePriority::LOW`
169+
* - `\Enqueue\Client\MessagePriority::NORMAL`
170+
* - `\Enqueue\Client\MessagePriority::HIGH`
171+
* - `\Enqueue\Client\MessagePriority::VERY_HIGH`
172+
* - `queue` - The name of a queue to use, from queue `config` array or
173+
* string 'default' if empty.
160174
* @return void
161175
*/
162176
public static function push($callable, array $args = [], array $options = []): void

0 commit comments

Comments
 (0)