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
Copy file name to clipboardExpand all lines: docs/commands.md
+20-20Lines changed: 20 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,25 +21,25 @@ Available options:
21
21
22
22
Allows you to publish a configuration class in the application namespace.
23
23
24
-
#### Example
24
+
#####Example
25
25
26
26
php spark queue:publish
27
27
28
28
### queue:job
29
29
30
30
Generates a new job file.
31
31
32
-
#### Arguments
32
+
#####Arguments
33
33
34
34
*`name` - The job class name.
35
35
36
-
#### Options
36
+
#####Options
37
37
38
38
*`--namespace` - Set root namespace. Default: "APP_NAMESPACE".
39
39
*`--suffix` - Append the component title to the class name (e.g. Email => EmailJob).
40
40
*`--force` - Force overwrite existing file.
41
41
42
-
#### Example
42
+
#####Example
43
43
44
44
php spark queue:job Email
45
45
@@ -49,11 +49,11 @@ It will generate the `Email` class in the `App\Jobs` namespace.
49
49
50
50
Allows you to consume jobs from a specific queue.
51
51
52
-
#### Arguments
52
+
#####Arguments
53
53
54
54
*`queueName` - Name of the queue we will work with.
55
55
56
-
#### Options
56
+
#####Options
57
57
58
58
*`-sleep` - Wait time between the next check for available job when the queue is empty. Default value: `10` (seconds).
59
59
*`-rest` - Rest time between the jobs in the queue. Default value: `0` (seconds)
@@ -64,7 +64,7 @@ Allows you to consume jobs from a specific queue.
64
64
*`-retry-after` - The number of seconds after which the job is to be restarted in case of failure. Overrides settings from the Job class. Disabled by default.
65
65
*`--stop-when-empty` - Stop when the queue is empty.
66
66
67
-
#### Example
67
+
#####Example
68
68
69
69
php spark queue:work emails -max-jobs 5
70
70
@@ -74,35 +74,35 @@ It will listen for 5 jobs from the `emails` queue and then stop.
74
74
75
75
Allows you to stop a specific queue in a safe way. It does this as soon as the job that is running in the queue is completed.
76
76
77
-
#### Arguments
77
+
#####Arguments
78
78
79
79
*`queueName` - Name of the queue we will work with.
80
80
81
-
#### Example
81
+
#####Example
82
82
83
83
php spark queue:stop emails
84
84
85
85
### queue:clear
86
86
87
87
Allows you to remove all jobs from a specific queue.
88
88
89
-
#### Arguments
89
+
#####Arguments
90
90
91
91
*`queueName` - Name of the queue we will work with.
92
92
93
-
#### Example
93
+
#####Example
94
94
95
95
php spark queue:clear emails
96
96
97
97
### queue:failed
98
98
99
99
Allows you to view all failed jobs. Also only from a specific queue
100
100
101
-
#### Options
101
+
#####Options
102
102
103
103
*`-queue` - Queue name.
104
104
105
-
#### Example
105
+
#####Example
106
106
107
107
php spark queue:failed -queue emails
108
108
@@ -112,15 +112,15 @@ It will list failed jobs from the `emails` queue.
112
112
113
113
Allows you to retry failed jobs back to the queue.
114
114
115
-
#### Arguments
115
+
#####Arguments
116
116
117
117
*`id` - ID of the failed job or "all" for all failed jobs.
118
118
119
-
#### Options
119
+
#####Options
120
120
121
121
*`-queue` - Queue name.
122
122
123
-
#### Example
123
+
#####Example
124
124
125
125
php spark queue:retry all -queue emails
126
126
@@ -130,24 +130,24 @@ It will retry all the failed jobs from the `emails` queue.
130
130
131
131
Allows you to delete the failed job by ID
132
132
133
-
#### Arguments
133
+
#####Arguments
134
134
135
135
*`id` - ID of the failed job.
136
136
137
-
#### Example
137
+
#####Example
138
138
139
139
php spark queue:forget 123
140
140
141
141
### queue:flush
142
142
143
143
Allows you to delete many failed jobs at once. Based on the failed date and queue.
Copy file name to clipboardExpand all lines: docs/running_queues.md
+3-9Lines changed: 3 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,19 +6,15 @@ Running a queue can be done in several ways. It all depends on what kind of envi
6
6
7
7
Since Supervisor is taking care of everything for us and will make out queue worker up and running, we can use this command:
8
8
9
-
```cli
10
-
php spark queue:work emails -wait 10
11
-
```
9
+
php spark queue:work emails -wait 10
12
10
13
11
This will cause command to check for the new jobs every 10 seconds if the queue is empty. But it will not quit. Waiting time is important since we don't want to overflow out database with the unnecessary queries.
14
12
15
13
### With CRON
16
14
17
15
Using queues with CRON is more challenging, but definitely doable. You can use command like this:
We can schedule CRON to execute our command every minute. This way, if there are no emails to handle, the command will quit immediately. And if there are many emails the batch of 20 will be handled every minute.
24
20
@@ -36,8 +32,6 @@ As mentioned above, sometimes we may want to have multiple instances of the same
36
32
37
33
If we decide to run the long process e.g. with the command:
38
34
39
-
```cli
40
-
php spark queue:work emails -wait 10
41
-
```
35
+
php spark queue:work emails -wait 10
42
36
43
37
We must remember to restart our command every time we add a new job or change the code in the existing job files. The reason is that the changes will not be visible before we restart the command.
0 commit comments