File tree 1 file changed +53
-0
lines changed
1 file changed +53
-0
lines changed Original file line number Diff line number Diff line change @@ -219,6 +219,59 @@ your ``CommandBus`` in your services:
219
219
services :
220
220
App\CommandBus : ['@messenger.bus.commands']
221
221
222
+ Middlewares
223
+ -----------
224
+
225
+ What happens when you dispatch a message to a message bus(es) depends on its
226
+ middlewares (and their order). By default, the middlewares configured for each
227
+ bus looks like this.
228
+
229
+ 1. ``logging `` middleware. Responsible of logging the beginning and the end of the
230
+ message within the bus.
231
+
232
+ 2. _Your own middlewares __
233
+
234
+ 3. ``route_messages `` middleware. Will route the messages your configured to their
235
+ corresponding sender and stop the middleware chain.
236
+
237
+ 4. ``call_message_handler `` middleware. Will call the message handler(s) for the
238
+ given message.
239
+
240
+ Adding your own middlewares
241
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
242
+
243
+ As described in the component documentation, you can add your own middlewares
244
+ within the buses to add some extra capabilities like this:
245
+
246
+ .. code-block :: yaml
247
+
248
+ framework :
249
+ messenger :
250
+ buses :
251
+ default :
252
+ middlewares :
253
+ # Works with the FQCN if the class discovery is enabled
254
+ - App\\Middleware\\MyMiddleware
255
+
256
+ # Or with some service name
257
+ - app.middleware.yours
258
+
259
+ Note that if the service is abstract, then a child service will be created per bus.
260
+
261
+ Disabling default middlewares
262
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
263
+
264
+ If you don't want the default middlewares to be present on your bus, you can disable
265
+ them like this:
266
+
267
+ .. code-block :: yaml
268
+
269
+ framework :
270
+ messenger :
271
+ buses :
272
+ default :
273
+ default_middlewares : false
274
+
222
275
Your own Transport
223
276
------------------
224
277
You can’t perform that action at this time.
0 commit comments