Chapters
48 Chapters
|
5:05:05
|
Login to bookmark this video
-
Course Code
Subscribe to download the code!Compatible PHP versions: ^7.1.3
Subscribe to download the code!Compatible PHP versions: ^7.1.3
-
This Video
Subscribe to download the video!
Subscribe to download the video!
-
Subtitles
Subscribe to download the subtitles!
Subscribe to download the subtitles!
-
Course Script
Subscribe to download the script!
Subscribe to download the script!
Scroll down to the script below, click on any sentence (including terminal blocks) to jump to that spot in the video!
Subscribe to jump to this part in the video!
Keep on Learning!
If you liked what you've learned so far, dive in! Subscribe to get access to this tutorial plus video, code and script downloads.
Este tutorial está construido con Symfony 4.3, pero funcionará bien en Symfony 4.4 o 5.
What PHP libraries does this tutorial use?
// composer.json
{
"require": {
"php": "^7.1.3",
"ext-ctype": "*",
"ext-iconv": "*",
"composer/package-versions-deprecated": "^1.11", // 1.11.99
"doctrine/annotations": "^1.0", // v1.8.0
"doctrine/doctrine-bundle": "^1.6.10", // 1.11.2
"doctrine/doctrine-migrations-bundle": "^1.3|^2.0", // v2.0.0
"doctrine/orm": "^2.5.11", // v2.6.3
"intervention/image": "^2.4", // 2.4.2
"league/flysystem-bundle": "^1.0", // 1.1.0
"phpdocumentor/reflection-docblock": "^3.0|^4.0", // 4.3.1
"sensio/framework-extra-bundle": "^5.3", // v5.3.1
"symfony/console": "4.3.*", // v4.3.2
"symfony/dotenv": "4.3.*", // v4.3.2
"symfony/flex": "^1.9", // v1.21.6
"symfony/framework-bundle": "4.3.*", // v4.3.2
"symfony/messenger": "4.3.*", // v4.3.4
"symfony/property-access": "4.3.*", // v4.3.2
"symfony/property-info": "4.3.*", // v4.3.2
"symfony/serializer": "4.3.*", // v4.3.2
"symfony/validator": "4.3.*", // v4.3.2
"symfony/webpack-encore-bundle": "^1.5", // v1.6.2
"symfony/yaml": "4.3.*" // v4.3.2
},
"require-dev": {
"easycorp/easy-log-handler": "^1.0.7", // v1.0.7
"symfony/debug-bundle": "4.3.*", // v4.3.2
"symfony/maker-bundle": "^1.0", // v1.12.0
"symfony/monolog-bundle": "^3.0", // v3.4.0
"symfony/stopwatch": "4.3.*", // v4.3.2
"symfony/twig-bundle": "4.3.*", // v4.3.2
"symfony/var-dumper": "4.3.*", // v4.3.2
"symfony/web-profiler-bundle": "4.3.*" // v4.3.2
}
}
7 Comments
Does there a way to use that unique id to remove a failed message from failure transport for example ?
Hey ahmedbhs
If you have a message hanging in the failed queue, then, you can use Messenger's commands to investigate more about it. There are these 3 commands you can play with and decide what to do with such a message
messenger:failed:remove
messenger:failed:retry
messenger:failed:show
Cheers!
Hi
if i have routing like this:
`
routing:
`
Is it possible somehow, (depend on some logic in code) to send message only to "<b>two</b>" transport?
I'm using AWS SQS.
Hey kwolniak
There is a way to do that, a bit confusing but possible. Here you can learn how https://symfonycasts.com/sc...
Cheers!
Thanks, I know this "from_transport" thing, but it's not what I need.
When I declare routing like above, SomeEvent message is sent automaticaly to one and two transport. And the same message appear in my case on one and two queue and in most cases it's OK.
But sometimes I want change it on the runtime in the code (for example somehow in middleware or before dispatch) and sent it only to one transport so message will appear only in one queue.
I have found that it should be possible with ampq and routing key but is it possible when I'm using enqueue/sqs?
Hey kwolniak!
This is currently a shortcoming with Messenger - and probably the one that bothers me the most! Routing is super static - there is no way to hook in at runtime to modify this. I think there should be, but it's not there yet. So, you have 2 options:
1) Do fanciness with routing key and amqp (or something similar in sqs... if there is such a mechanism). This is basically you going outside of the system to get what you want ;).
2) Create 2 different classes: one that routes to both transports and another that routes to only one.
SUPER not ideal, but that's the state of things. Hmm, or you could do something totally nuts and "decorate" (with Symfony service decoration) the
messenger.senders_locatorservice (which is this class https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Messenger/Transport/Sender/SendersLocator.php) and do some custom logic there. That is the "I'm taking full control" hammer solution to the problem - but because there isn't such a nice solution yet, I won't be disappointed if you do it ;).Cheers!
Thank you very much for the comprehensive answer!
For now I decided on two separate events and two separate transports, and before dispatch I do some logic.
Thanks anyway :)
"Houston: no signs of life"
Start the conversation!