Skip to content

Commit 9a55536

Browse files
committed
Merge branch '4.3' into 4.4
* 4.3: [Mailer] Better explain the load-balancing options
2 parents b7fcaba + de1f9a8 commit 9a55536

File tree

1 file changed

+22
-15
lines changed

1 file changed

+22
-15
lines changed

components/mailer.rst

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -99,31 +99,36 @@ binary. For third-party providers, refers to the following table:
9999
Sendgrid smtp://apikey:KEY@sendgrid n/a api://KEY@sendgrid
100100
==================== ================================== ================================== ================================
101101

102-
Failover Transport
103-
------------------
102+
Load Balancing
103+
--------------
104104

105-
You can create failover transport with the help of ``failover()`` keyword::
105+
Symfony's mailer supports `load balancing`_ so you can distribute the mailing
106+
workload across multiple transports. There are two main techniques to balance
107+
the load: failover and round-robin.
106108

107-
$dsn = 'failover(api://id@postmark smtp://key@sendgrid)';
109+
Failover Load Balancing
110+
~~~~~~~~~~~~~~~~~~~~~~~
108111

109-
So if the first transport fails, the mailer will attempt to send through the
110-
second transport.
112+
A failover transport is configured with two or more transports and the
113+
``failover`` keyword::
111114

112-
.. versionadded:: 4.4
115+
$dsn = 'failover(api://id@postmark smtp://key@sendgrid)';
113116

114-
The ``failover()`` keyword was introduced in Symfony 4.4.
117+
The mailer will start using the first transport. If the sending fails, the
118+
mailer won't retry it with the other transports, but it will switch to the next
119+
transport automatically for the following deliveries.
115120

116-
Round Robin
117-
-----------
121+
Round-Robin Load Balancing
122+
~~~~~~~~~~~~~~~~~~~~~~~~~~
118123

119-
If you want to send emails by using multiple transports in a round-robin fashion,
120-
you can use the ``roundrobin()`` keyword with the transports::
124+
A round-robin transport is configured with two or more transports and the
125+
``roundrobin`` keyword::
121126

122127
$dsn = 'roundrobin(api://id@postmark smtp://key@sendgrid)'
123128

124-
.. versionadded:: 4.4
125-
126-
The ``roundrobin()`` keyword was introduced in Symfony 4.4.
129+
The mailer will start using the first transport and if it fails, it will retry
130+
the same delivery with the next transports until one of them succeeds (or until
131+
all of them fail).
127132

128133
Sending emails asynchronously
129134
-----------------------------
@@ -174,3 +179,5 @@ Learn More
174179

175180
To learn more about how to use the mailer component, refer to the
176181
:doc:`Symfony Framework Mailer documentation </mailer>`.
182+
183+
.. _`load balancing`: https://en.wikipedia.org/wiki/Load_balancing_(computing)

0 commit comments

Comments
 (0)