@@ -86,14 +86,13 @@ that will do the required processing for your message::
86
86
}
87
87
}
88
88
89
- Envelope
90
- --------
89
+ Adding Metadata to Messages (Envelopes)
90
+ ---------------------------------------
91
91
92
- The notion of an envelope is a concept that helps add context around the
93
- messages. An envelope is a message and a set of data. From a user's perspective, this
94
- allows you to set some configuration around the message. For example, to set the serialization
95
- groups used when the message goes through the transport layer, wrap your message
96
- in an ``Envelope `` and add some ``SerializerConfiguration ``::
92
+ If you need to add metadata or some configuration to a message, wrap it with the
93
+ :class: `Symfony\\ Component\\ Messenger\\ Envelope ` class. For example, to set the
94
+ serialization groups used when the message goes through the transport layer, use
95
+ the ``SerializerConfiguration `` envelope::
97
96
98
97
use Symfony\Component\Messenger\Envelope;
99
98
use Symfony\Component\Messenger\Transport\Serialization\SerializerConfiguration;
@@ -126,8 +125,7 @@ marker, like this::
126
125
public function handle($message, callable $next)
127
126
{
128
127
// $message here is an `Envelope` object, because this middleware
129
- // implements the EnvelopeAwareInterface interface. Otherwise,
130
- // it would be the "original" message.
128
+ // implements the EnvelopeAwareInterface interface.
131
129
132
130
if (null !== $message->get(ReceivedMessage::class)) {
133
131
// Message just has been received...
0 commit comments