8000 Add a documentation about Messenger's transports by llaakkkk · Pull Request #11331 · symfony/symfony-docs · GitHub
[go: up one dir, main page]

Skip to content

Add a documentation about Messenger's transports #11331

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixup! Add a documentation about Messenger's transports
  • Loading branch information
Olena Kirichok committed Apr 7, 2019
commit cf224cd5fb03ea47897fd29a541d36c0b169661b
4 changes: 2 additions & 2 deletions components/messenger.rst
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ Transports
In order to send and receive messages, you will have to configure a transport. A
transport will be responsible for communicating with your message broker or 3rd parties.

.. note:
.. seealso::

Check out the :doc:`Messenger transports documentation </components/messenger/transports>`.

Expand Down Expand Up @@ -303,7 +303,7 @@ First, create your receiver::
Receiver and Sender on the same Bus
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

In order to receive and send messages on the same bus and prevent an infinite
To receive and send messages on the same bus and prevent an infinite
loop, the message bus will add a :class:`Symfony\\Component\\Messenger\\Stamp\\ReceivedStamp`
stamp to the message envelopes and the :class:`Symfony\\Component\\Messenger\\Middleware\\SendMessageMiddleware`
middleware will know it should not route these messages again to a transport.
Expand Down
20 changes: 8 additions & 12 deletions components/messenger/transports.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ support for AMQP.
How it works?
~~~~~~~~~~~~~

A DSN protocol that uses ``amqp`` is recognized and sent to the built-in AMQP transport.
For example::
A DSN that starts with ``amqp://`` is recognized and used to create
an instance of the built-in AMQP transport::

$dsn = 'amqp://user:password@localhost/%2f/messages'
$dsn = 'amqp://user:password@localhost/%2f/messages';

The messages will be sent to the ``messages`` exchange bound to the ``messages``
queue on the ``/`` vhost (the ``%2f`` is a url-encoded ``/``).

.. note:
.. note::

By default, RabbitMQ uses ``guest`` as a username and ``guest`` as a password
and has a ``/`` vhost.
Expand Down Expand Up @@ -58,7 +58,7 @@ retry mechanism that can be enabled via your DSN::
&retry[ttl][2]=60000

In the example above, if handling the message fails, it will retry it 3 times. After
the first failure, it will wait 10 seconds before trying it. After the 2nd failure,
the first failure, it will wait 10 seconds before trying it. After the second failure,
it will wait 30 seconds. After the 3rd failure, it will wait a minute. If it still
fails, the message will be moved to a "dead queue" and you will have to manually
handle this message.
Expand Down Expand Up @@ -88,9 +88,7 @@ Your own sender
Using the ``SenderInterface``, you can easily create your own message sender.
Let's say you already have an ``ImportantAction`` message going through the
message bus and handled by a handler. Now, you also want to send this message as
an email.

First, create your sender::
an email via your sender::

namespace App\MessageSender;

Expand Down Expand Up @@ -137,9 +135,7 @@ application but you can't use an API and need to use a shared CSV file with new
orders.

You will read this CSV file and dispatch a ``NewOrder`` message. All you need to
do is to write your custom CSV receiver and Symfony will do the rest.

First, create your receiver::
do is to write your custom CSV receiver and Symfony will do the rest::

namespace App\MessageReceiver;

Expand Down Expand Up @@ -177,7 +173,7 @@ Create your Transport Factory
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

You need to give FrameworkBundle the opportunity to create your transport from a
DSN. You will need an transport factory::
DSN. You will need a transport factory::

use Symfony\Component\Messenger\Transport\TransportFactoryInterface;
use Symfony\Component\Messenger\Transport\TransportInterface;
Expand Down
0