You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: Queue::push() to return QueuePushResult instead of boolean (#62)
* feat: return jobID after push instead of the bool value
* fix phpcpd
* feat: return QueuePushResult from push() instead of bool
* add some PHPDocs to QueuePushResult class
We will be pushing `email` job to the `emails` queue.
162
162
163
+
As a result of calling the `push()` method, you will receive a `QueuePushResult` object, which you can inspect if needed. It provides the following information:
164
+
165
+
-`getStatus()`: Indicates whether the job was successfully added to the queue.
166
+
-`getJobId()`: Returns the ID of the job that was added to the queue.
167
+
-`getError()`: Returns any error that occurred if the job was not added.
168
+
163
169
### Sending chained jobs to the queue
164
170
165
171
Sending chained jobs is also simple and lets you specify the particular order of the job execution.
In the example above, we will send jobs to the `reports` and `emails`queue. First, we will generate a report for given user with the `generate-report` job, after this, we will send an email with `email` job.
181
+
In the example above, we will send jobs to the `reports` and `emails`queues. First, we will generate a report for given user with the `generate-report` job, after this, we will send an email with `email` job.
176
182
The `email` job will be executed only if the `generate-report` job was successful.
177
183
184
+
As with the `push()` method, calling the `chain()` method also returns a `QueuePushResult` object.
185
+
178
186
### Consuming the queue
179
187
180
188
Since we sent our sample job to queue `emails`, then we need to run the worker with the appropriate queue:
0 commit comments