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
php artisan operations:process // process operation files
50
50
php artisan operations:process --sync // force syncronously execution
51
51
php artisan operations:process --async // force asyncronously execution
52
+
php artisan operations:process --queue=<name> // force queue, that the job will be dispatched to
52
53
php artisan operations:process --test // dont flag operations as processed
53
54
php artisan operations:process <operation_name> // re-run one specific operation
54
55
```
@@ -130,6 +131,11 @@ return new class extends OneTimeOperation
130
131
* Determine if the operation is being processed asyncronously.
131
132
*/
132
133
protected bool $async = true;
134
+
135
+
/**
136
+
* The queue that the job will be dispatched to.
137
+
*/
138
+
protected string $queue = 'default';
133
139
134
140
/**
135
141
* Process the operation.
@@ -155,10 +161,13 @@ public function process(): void
155
161
```
156
162
157
163
By default, the operation is being processed ***asyncronously*** (based on your configuration) by dispatching the job `OneTimeOperationProcessJob`.
164
+
By default, the operation is being dispatched to the `default` queue of your project. Change the `$queue` as you wish.
158
165
159
166
You can also execute the code syncronously by setting the `$async` flag to `false`.
160
167
_(this is only recommended for small operations, since the processing of these operations should be part of the deployment process)_
161
168
169
+
**Hint:** If you use syncronous processing, the `$queue` attribute will be ignored (duh!).
170
+
162
171
### Processing the operations
163
172
164
173

**Hint!** If `operation:process` is part of your deployment process, it is **not recommended** to process the operations syncronously,
193
202
since an error in your operation could make your whole deployment fail.
194
203
204
+
### Force different queue for all operations
205
+
206
+
You can provide the `--queue` option in the artisan call. The given queue will be used for all operations, ignoring the `$queue` attribute in the class.
207
+
208
+
```shell
209
+
php artisan operations:process --queue=redis // force redis queue
210
+
```
211
+
195
212
### Re-run an operation
196
213
197
214

0 commit comments