Skip to content

Commit 4fd8a44

Browse files
committed
Merge branch '6.3' into 6.4
* 6.3: [Messenger] Clarify transport creation example
2 parents c931bb0 + 9bdaa8b commit 4fd8a44

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

components/messenger.rst

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,16 +292,22 @@ do is to write your own CSV receiver::
292292

293293
class NewOrdersFromCsvFileReceiver implements ReceiverInterface
294294
{
295+
private $connection;
296+
295297
public function __construct(
296298
private SerializerInterface $serializer,
297299
private string $filePath,
298300
) {
301+
// Available connection bundled with the Messenger component
302+
// can be found in "Symfony\Component\Messenger\Bridge\*\Transport\Connection".
303+
$this->connection = /* create your connection */;
299304
}
300305

301306
public function get(): iterable
302307
{
303308
// Receive the envelope according to your transport ($yourEnvelope here),
304309
// in most cases, using a connection is the easiest solution.
310+
$yourEnvelope = $this->connection->get();
305311
if (null === $yourEnvelope) {
306312
return [];
307313
}
@@ -327,7 +333,9 @@ do is to write your own CSV receiver::
327333
public function reject(Envelope $envelope): void
328334
{
329335
// In the case of a custom connection
330-
$this->connection->reject($this->findCustomStamp($envelope)->getId());
336+
$id = /* get the message id thanks to information or stamps present in the envelope */;
337+
338+
$this->connection->reject($id);
331339
}
332340
}
333341

0 commit comments

Comments
 (0)