@@ -5,7 +5,7 @@ How to Use the Messenger
5
5
========================
6
6
7
7
Symfony's Messenger provide a message bus and some routing capabilities to send
8
- messages within your application and through adapters such as message queues.
8
+ messages within your application and through transports such as message queues.
9
9
Before using it, read the :doc: `Messenger component docs </components/messenger >`
10
10
to get familiar with its concepts.
11
11
@@ -70,19 +70,19 @@ Once you've created your handler, you need to register it:
70
70
If the message cannot be guessed from the handler's type-hint, use the
71
71
``handles `` attribute on the tag.
72
72
73
- Adapters
74
- --------
73
+ Transports
74
+ ----------
75
75
76
76
The communication with queuing system or third parties is delegated to
77
- libraries for now. The built-in AMQP adapter allows you to communicate with
77
+ libraries for now. The built-in AMQP transport allows you to communicate with
78
78
most of the AMQP brokers such as RabbitMQ.
79
79
80
80
.. note ::
81
81
82
- If you need more message brokers, you should have a look to `Enqueue's adapter `_
82
+ If you need more message brokers, you should have a look to `Enqueue's transport `_
83
83
which supports things like Kafka, Amazon SQS or Google Pub/Sub.
84
84
85
- An adapter is registered using a "DSN", which is a string that represents the
85
+ A transport is registered using a "DSN", which is a string that represents the
86
86
connection credentials and configuration. By default, when you've installed
87
87
the messenger component, the following configuration should have been created:
88
88
@@ -91,7 +91,7 @@ the messenger component, the following configuration should have been created:
91
91
# config/packages/messenger.yaml
92
92
framework :
93
93
messenger :
94
- adapters :
94
+ transports :
95
95
amqp : " %env(MESSENGER_DSN)%"
96
96
97
97
.. code-block :: bash
@@ -111,7 +111,7 @@ Routing
111
111
-------
112
112
113
113
Instead of calling a handler, you have the option to route your message(s) to a
114
- sender. Part of an adapter , it is responsible for sending your message somewhere.
114
+ sender. Part of a transport , it is responsible for sending your message somewhere.
115
115
You can configure which message is routed to which sender with the following
116
116
configuration:
117
117
@@ -120,7 +120,7 @@ configuration:
120
120
framework :
121
121
messenger :
122
122
routing :
123
- ' My\Message\Message ' : amqp # The name of the defined adapter
123
+ ' My\Message\Message ' : amqp # The name of the defined transport
124
124
125
125
Such configuration would only route the ``My\Message\Message `` message to be
126
126
asynchronous, the rest of the messages would still be directly handled.
@@ -132,7 +132,7 @@ You can route all classes of message to a sender using an asterisk instead of a
132
132
framework :
133
133
messenger :
134
134
routing :
135
- ' My\Message\MessageAboutDoingOperationalWork ' : another_adapter
135
+ ' My\Message\MessageAboutDoingOperationalWork ' : another_transport
136
136
' * ' : amqp
137
137
138
138
A class of message can also be routed to multiple senders by specifying a list:
@@ -166,25 +166,25 @@ like this:
166
166
$ bin/console messenger:consume-messages amqp
167
167
168
168
The first argument is the receiver's service name. It might have been created by
169
- your ``adapters `` configuration or it can be your own receiver.
169
+ your ``transports `` configuration or it can be your own receiver.
170
170
171
- Your own Adapters
172
- -----------------
171
+ Your own Transport
172
+ ------------------
173
173
174
- Once you have written your adapter 's sender and receiver, you can register your
175
- adapter factory to be able to use it via a DSN in the Symfony application.
174
+ Once you have written your transport 's sender and receiver, you can register your
175
+ transport factory to be able to use it via a DSN in the Symfony application.
176
176
177
- Create your adapter Factory
177
+ Create your Transport Factory
178
178
~~~~~~~~~~~~~~~~~~~~~~~~~~~
179
179
180
- You need to give FrameworkBundle the opportunity to create your adapter from a
181
- DSN. You will need an adapter factory::
180
+ You need to give FrameworkBundle the opportunity to create your transport from a
181
+ DSN. You will need an transport factory::
182
182
183
- use Symfony\Component\Messenger\Adapter \Factory\AdapterFactoryInterface;
183
+ use Symfony\Component\Messenger\Transport \Factory\AdapterFactoryInterface;
184
184
use Symfony\Component\Messenger\Transport\ReceiverInterface;
185
185
use Symfony\Component\Messenger\Transport\SenderInterface;
186
186
187
- class YourAdapterFactory implements AdapterFactoryInterface
187
+ class YourTransportFactory implements TransportFactoryInterface
188
188
{
189
189
public function createReceiver(string $dsn, array $options): ReceiverInterface
190
190
{
@@ -198,7 +198,7 @@ DSN. You will need an adapter factory::
198
198
199
199
public function supports(string $dsn, array $options): bool
200
200
{
201
- return 0 === strpos($dsn, 'my-adapter ://');
201
+ return 0 === strpos($dsn, 'my-transport ://');
202
202
}
203
203
}
204
204
@@ -207,27 +207,27 @@ Register your factory
207
207
208
208
.. code-block :: xml
209
209
210
- <service id =" Your\Adapter\YourAdapterFactory " >
211
- <tag name =" messenger.adapter_factory " />
210
+ <service id =" Your\Transport\YourTransportFactory " >
211
+ <tag name =" messenger.transport_factory " />
212
212
</service >
213
213
214
- Use your adapter
215
- ~~~~~~~~~~~~~~~~
214
+ Use your transport
215
+ ~~~~~~~~~~~~~~~~~~
216
216
217
- Within the ``framework.messenger.adapters .* `` configuration, create your
218
- named adapter using your own DSN:
217
+ Within the ``framework.messenger.transports .* `` configuration, create your
218
+ named transport using your own DSN:
219
219
220
220
.. code-block :: yaml
221
221
222
222
framework :
223
223
messenger :
224
- adapters :
225
- yours : ' my-adapter ://...'
224
+ transports :
225
+ yours : ' my-transport ://...'
226
226
227
227
In addition of being able to route your messages to the ``yours `` sender, this
228
228
will give you access to the following services:
229
229
230
230
#. ``messenger.sender.yours ``: the sender.
231
231
#. ``messenger.receiver.yours ``: the receiver.
232
232
233
- .. _`enqueue's adapter ` : https://github.com/sroze/enqueue-bridge
233
+ .. _`enqueue's transport ` : https://github.com/sroze/enqueue-bridge
0 commit comments