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.
This tutorial is built with Symfony 4.3, but will work well on Symfony 4.4 or 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
}
}
9 Comments
Hi guys,
In this tutorial, you use the doctrine to store failures messages. Why you don't store them in RabbitMq with that x-dead-letter-exchange ? Is there any specific reason ? Thanks
Hey @Dang
Yea, you can store your failed messages in RabbitMq as well but we kept using Doctrine just for simplicity reasons.
Cheers!
Hi, guys. As always great course, one of your finest.
Can a message be delayed for a whole month? My use case is to schedule a task to check in a month if a notification has been read and if not delete it. Would this AMQP delays would be useful for such a task?
Thanks a lot
Hey danresmejia!
> Can a message be delayed for a whole month?
Ha! That's a fun question :). Umm... maybe? I think this is not the normal use-case. It might work in theory (you'd need to make sure AMQP is "persistent" so that messages aren't lost on shutdown), but I'm not sure this would be wise. I could *totally* be wrong and maybe this is normal, I just haven't heard of amqp being used with such long delays. Personally, I would probably do this with a custom console command that "checks for all unread messages that are older than 1 month" and deletes them. Then I'd run that on a CRON job as often as you need :).
Cheers!
Thanks for getting back to me. A cron job is what I do now, it works fine until it doesn't ;) and then debugging is hard. Also everything we do is in a multi tenant context so the command needs to check every notification for every tenant as each tenant lives in a different data base. For me it seems that a message on an async queue is the perfect choice as I'd know that for every created notification a message would be also created to check it validity in a month.
Also is important to point out that on the JMS Job Queue we had such feature, i.e. a message would only be processed on an specific date and time if such thing is needed. In that regard I see that doctrine transport table has a field called 'available_at' it seems to be related to it. What do you thing?
One last idea is to have the handler sending a message to the event bus if the notification is not yet ready to be deleted, not old enough. It could be an alternative if the AMQP implementation doesn't persist delayed messages over reboots or outages.
Cheers!
Hey danresmejia!
> In that regard I see that doctrine transport table has a field called 'available_at' it seems to be related to it. What do you thing?
Especially with the Doctrine transport, I certainly can't see a problem with super-delayed messages like this (I'm less certain about how appropriate this is with AMQP).
So... I think it would be fine to run with this :).
Cheers and sorry for the slow reply!
Thanks weaverryan !
Hi, thank you for great totorials!
There is wrong command at this page:
php bin/console -vv async_priority_high async
Insted of:
php bin/console messenger:consume -vv async_priority_high async
Hey php-programmist
Good catch! Thanks!
"Houston: no signs of life"
Start the conversation!