@@ -38,9 +38,11 @@ Concepts
38
38
Bus
39
39
---
40
40
41
- The bus is used to dispatch messages. MessageBus' behaviour is in its ordered
42
- middleware stack. When using the message bus with Symfony's FrameworkBundle, the
43
- following middlewares are configured for you:
41
+ The bus is used to dispatch messages. The behaviour of the bus is in its ordered
42
+ middleware stack. The component comes with a set of middlewares that you can use.
43
+
44
+ When using the message bus with Symfony's FrameworkBundle, the following middlewares
45
+ are configured for you:
44
46
45
47
#. :code: `LoggingMiddleware ` (logs the processing of your messages)
46
48
#. :code: `SendMessageMiddleware ` (enables asynchronous processing)
@@ -56,11 +58,15 @@ Example::
56
58
$bus = new MessageBus([
57
59
new HandleMessageMiddleware(new HandlerLocator([
58
60
MyMessage::class => $handler,
59
- ]))
61
+ ])),
60
62
]);
61
63
62
64
$result = $bus->handle(new MyMessage(/* ... */));
63
65
66
+ .. note:
67
+
68
+ Every middleware need to implement the :code:`MiddlewareInterface` interface.
69
+
64
70
Handlers
65
71
--------
66
72
@@ -87,11 +93,8 @@ Adapters
87
93
The communication with queuing system or third parties is delegated to
88
94
libraries for now.
89
95
90
- Create your adapter
91
- ~~~~~~~~~~~~~~~~~~~
92
-
93
96
Your own sender
94
- ---------------
97
+ ~~~~~~~~~~~~~~~
95
98
96
99
Using the ``SenderInterface ``, you can easily create your own message sender.
97
100
Let's say you already have an ``ImportantAction `` message going through the
@@ -134,7 +137,7 @@ First, create your sender::
134
137
}
135
138
136
139
Your own receiver
137
- -----------------
140
+ ~~~~~~~~~~~~~~~~~
138
141
139
142
A receiver is responsible for receiving messages from a source and dispatching
140
143
them to the application.
0 commit comments