8000 Rename the adapters to transport · symfony/symfony-docs@a4bc592 · GitHub
[go: up one dir, main page]

Skip to content

Commit a4bc592

Browse files
srozeweaverryan
authored andcommitted
Rename the adapters to transport
1 parent cc6768e commit a4bc592

File tree

2 files changed

+35
-35
lines changed

2 files changed

+35
-35
lines changed

components/messenger.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,11 @@ that will do the required processing for your message::
8686
}
8787
}
8888

89-
Adapters
90-
--------
89+
Transports
90+
----------
9191

92-
In order to send and receive messages, you will have to configure an adapter. An
93-
adapter will be responsible of communicating with your message broker or 3rd parties.
92+
In order to send and receive messages, you will have to configure a transport. An
93+
transport will be responsible of communicating with your message broker or 3rd parties.
9494

9595
Your own sender
9696
~~~~~~~~~~~~~~~
@@ -190,4 +190,4 @@ To allow us to receive and send messages on the same bus and prevent an infinite
190190
loop, the message bus is equipped with the ``WrapIntoReceivedMessage`` middleware.
191191
It will wrap the received messages into ``ReceivedMessage`` objects and the
192192
``SendMessageMiddleware`` middleware will know it should not route these
193-
messages again to an adapter.
193+
messages again to a transport.

messenger.rst

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ How to Use the Messenger
55
========================
66

77
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.
99
Before using it, read the :doc:`Messenger component docs </components/messenger>`
1010
to get familiar with its concepts.
1111

@@ -70,19 +70,19 @@ Once you've created your handler, you need to register it:
7070
If the message cannot be guessed from the handler's type-hint, use the
7171
``handles`` attribute on the tag.
7272

73-
Adapters
74-
--------
73+
Transports
74+
----------
7575

7676
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
7878
most of the AMQP brokers such as RabbitMQ.
7979

8080
.. note::
8181

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`_
8383
which supports things like Kafka, Amazon SQS or Google Pub/Sub.
8484

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
8686
connection credentials and configuration. By default, when you've installed
8787
the messenger component, the following configuration should have been created:
8888

@@ -91,7 +91,7 @@ the messenger component, the following configuration should have been created:
9191
# config/packages/messenger.yaml
9292
framework:
9393
messenger:
94-
adapters:
94+
transports:
9595
amqp: "%env(MESSENGER_DSN)%"
9696
9797
.. code-block:: bash
@@ -111,7 +111,7 @@ Routing
111111
-------
112112

113113
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.
115115
You can configure which message is routed to which sender with the following
116116
configuration:
117117

@@ -120,7 +120,7 @@ configuration:
120120
framework:
121121
messenger:
122122
routing:
123-
'My\Message\Message': amqp # The name of the defined adapter
123+
'My\Message\Message': amqp # The name of the defined transport
124124
125125
Such configuration would only route the ``My\Message\Message`` message to be
126126
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
132132
framework:
133133
messenger:
134134
routing:
135-
'My\Message\MessageAboutDoingOperationalWork': another_adapter
135+
'My\Message\MessageAboutDoingOperationalWork': another_transport
136136
'*': amqp
137137
138138
A class of message can also be routed to multiple senders by specifying a list:
@@ -166,25 +166,25 @@ like this:
166166
$ bin/console messenger:consume-messages amqp
167167
168168
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.
170170

171-
Your own Adapters
172-
-----------------
171+
Your own Transport
172+
------------------
173173

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.
176176

177-
Create your adapter Factory
177+
Create your Transport Factory
178178
~~~~~~~~~~~~~~~~~~~~~~~~~~~
179179

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::
182182

183-
use Symfony\Component\Messenger\Adapter\Factory\AdapterFactoryInterface;
183+
use Symfony\Component\Messenger\Transport\Factory\AdapterFactoryInterface;
184184
use Symfony\Component\Messenger\Transport\ReceiverInterface;
185185
use Symfony\Component\Messenger\Transport\SenderInterface;
186186

187-
class YourAdapterFactory implements AdapterFactoryInterface
187+
class YourTransportFactory implements TransportFactoryInterface
188188
{
189189
public function createReceiver(string $dsn, array $options): ReceiverInterface
190190
{
@@ -198,7 +198,7 @@ DSN. You will need an adapter factory::
198198

199199
public function supports(string $dsn, array $options): bool
200200
{
201-
return 0 === strpos($dsn, 'my-adapter://');
201+
return 0 === strpos($dsn, 'my-transport://');
202202
}
203203
}
204204

@@ -207,27 +207,27 @@ Register your factory
207207

208208
.. code-block:: xml
209209
210-
<service id="Your\Adapter\YourAdapterFactory">
211-
<tag name="messenger.adapter_factory" />
210+
<service id="Your\Transport\YourTransportFactory">
211+
<tag name="messenger.transport_factory" />
212212
</service>
213213
214-
Use your adapter
215-
~~~~~~~~~~~~~~~~
214+
Use your transport
215+
~~~~~~~~~~~~~~~~~~
216216

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:
219219

220220
.. code-block:: yaml
221221
222222
framework:
223223
messenger:
224-
adapters:
225-
yours: 'my-adapter://...'
224+
transports:
225+
yours: 'my-transport://...'
226226
227227
In addition of being able to route your messages to the ``yours`` sender, this
228228
will give you access to the following services:
229229

230230
#. ``messenger.sender.yours``: the sender.
231231
#. ``messenger.receiver.yours``: the receiver.
232232

233-
.. _`enqueue's adapter`: https://github.com/sroze/enqueue-bridge
233+
.. _`enqueue's transport`: https://github.com/sroze/enqueue-bridge

0 commit comments

Comments
 (0)
0