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
| 13 | 9 | August 8th, 2023 |[Documentation](https://github.com/vyuldashev/laravel-queue-rabbitmq/blob/master/README.md)|
18
16
19
17
## Installation
20
18
@@ -74,10 +72,11 @@ Add connection to `config/queue.php`:
74
72
75
73
### Optional Config
76
74
77
-
Optionally add queue options to the config of a connection.
75
+
Optionally add queue options to the config of a connection.
78
76
Every queue created for this connection, get's the properties.
79
77
80
78
When you want to prioritize messages when they were delayed, then this is possible by adding extra options.
79
+
81
80
- When max-priority is omitted, the max priority is set with 2 when used.
82
81
83
82
```php
@@ -102,12 +101,13 @@ When you want to prioritize messages when they were delayed, then this is possib
102
101
```
103
102
104
103
When you want to publish messages against an exchange with routing-key's, then this is possible by adding extra options.
104
+
105
105
- When the exchange is omitted, RabbitMQ will use the `amq.direct` exchange for the routing-key
106
106
- When routing-key is omitted the routing-key by default is the `queue` name.
107
107
- When using `%s` in the routing-key the queue_name will be substituted.
108
108
109
109
> Note: when using exchange with routing-key, u probably create your queues with bindings yourself.
110
-
110
+
111
111
```php
112
112
'connections' => [
113
113
// ...
@@ -130,14 +130,18 @@ When you want to publish messages against an exchange with routing-key's, then t
130
130
],
131
131
```
132
132
133
-
In Laravel failed jobs are stored into the database. But maybe you want to instruct some other process to also do something with the message.
134
-
When you want to instruct RabbitMQ to reroute failed messages to a exchange or a specific queue, then this is possible by adding extra options.
133
+
In Laravel failed jobs are stored into the database. But maybe you want to instruct some other process to also do
134
+
something with the message.
135
+
When you want to instruct RabbitMQ to reroute failed messages to a exchange or a specific queue, then this is possible
136
+
by adding extra options.
137
+
135
138
- When the exchange is omitted, RabbitMQ will use the `amq.direct` exchange for the routing-key
136
139
- When routing-key is omitted, the routing-key by default the `queue` name is substituted with `'.failed'`.
137
140
- When using `%s` in the routing-key the queue_name will be substituted.
138
141
139
-
> Note: When using failed_job exchange with routing-key, u probably need to create your exchange/queue with bindings yourself.
140
-
142
+
> Note: When using failed_job exchange with routing-key, u probably need to create your exchange/queue with bindings
143
+
> yourself.
144
+
141
145
```php
142
146
'connections' => [
143
147
// ...
@@ -161,12 +165,14 @@ When you want to instruct RabbitMQ to reroute failed messages to a exchange or a
161
165
```
162
166
163
167
### Use your own RabbitMQJob class
168
+
164
169
Sometimes you have to work with messages published by another application.
165
170
Those messages probably won't respect Laravel's job payload schema.
166
-
The problem with these messages is that, Laravel workers won't be able to determine the actual job or class to execute.
171
+
The problem with these messages is that, Laravel workers won't be able to determine the actual job or class to execute.
167
172
168
173
You can extend the build-in `RabbitMQJob::class` and within the queue connection config, you can define your own class.
169
-
When you specify an `job` key in the config, with your own class name, every message retrieved from the broker will get wrapped by your own class.
174
+
When you specify an `job` key in the config, with your own class name, every message retrieved from the broker will get
175
+
wrapped by your own class.
170
176
171
177
An example for the config:
172
178
@@ -250,11 +256,14 @@ class RabbitMQJob extends BaseJob
250
256
251
257
## Laravel Usage
252
258
253
-
Once you completed the configuration you can use Laravel Queue API. If you used other queue drivers you do not need to change anything else. If you do not know how to use Queue API, please refer to the official Laravel documentation: http://laravel.com/docs/queues
259
+
Once you completed the configuration you can use Laravel Queue API. If you used other queue drivers you do not need to
260
+
change anything else. If you do not know how to use Queue API, please refer to the official Laravel
261
+
documentation: http://laravel.com/docs/queues
254
262
255
263
## Laravel Horizon Usage
256
264
257
-
Starting with 8.0, this package supports [Laravel Horizon](http://horizon.laravel.com) out of the box. Firstly, install Horizon and then set `RABBITMQ_WORKER` to `horizon`.
265
+
Starting with 8.0, this package supports [Laravel Horizon](http://horizon.laravel.com) out of the box. Firstly, install
266
+
Horizon and then set `RABBITMQ_WORKER` to `horizon`.
1.`queue:work` command which is Laravel's built-in command. This command utilizes `basic_get`.
272
281
273
-
2.`rabbitmq:consume` command which is provided by this package. This command utilizes `basic_consume` and is more performant than `basic_get` by ~2x.
282
+
2.`rabbitmq:consume` command which is provided by this package. This command utilizes `basic_consume` and is more
283
+
performant than `basic_get` by ~2x.
274
284
275
285
## Testing
276
286
@@ -302,4 +312,5 @@ composer fix:style
302
312
303
313
## Contribution
304
314
305
-
You can contribute to this package by discovering bugs and opening issues. Please, add to which version of package you create pull request or issue. (e.g. [5.2] Fatal error on delayed job)
315
+
You can contribute to this package by discovering bugs and opening issues. Please, add to which version of package you
316
+
create pull request or issue. (e.g. [5.2] Fatal error on delayed job)
0 commit comments