No video
Nest.js | Events & Task Scheduling Tutorial
In this video, we learn about how to decouple functionality in our application leading to faster backend services and cleaner code.
Github Repo: github.com/mgu...
Nest.js Events: docs.nestjs.co...
Nest.js Tasks: docs.nestjs.co...
Timestamps
00:00:00 Project Setup
00:03:50 Events
00:09:17 Task Scheduling
Get my highly-rated Udemy courses at a discount here: michaelguay.de...
Пікірлер: 50
Get my highly-rated Udemy courses at a discount here: michaelguay.dev/udemy/
Great video, Michael! One of the very few channels making such informative videos on NestJS. Looking forward to your next one - the end to end guide on micro-services using NestJS.
@gulsharangoraya6707
2 жыл бұрын
I hope you are planning to include a tutorial on how to deploy them on AWS. 🤞😇
Love how you explain. I just started out with nestjs last week and watching this video shows me how much I can improve. Thanks for the awesome content.
Nestjs is so cool !! My company has a plan on switching to nestjs. Thanks for these contents man!
Thank you for making actually useful videos and not just how to create a todo or something.
You are best backend developer bro💪🤩
I just subscribed to your channel because of this, man. I love it.
You're the best bro. I love your videos
@mguay
2 жыл бұрын
I appreciate that!
Hi Michael, I was trying to implement a functionality with events, to run several operations in a transaction, but I don't know how to handle it, so everything is rolled back if any of the operations fail. would you mind giving an advice on how to do that kind of behaviour?
Cool! Thanx a lot, bro! Info as always useful!!
Thanks! Great as always!
Impressive tutorial 😊 Subscribed ✅
This was a really good video
Hey Michael, really great video! One quick question: Can the event be listened from any module of the app or only inside the class where you emit it from? Keep up the amazing NestJS videos!!
@mguay
5 ай бұрын
We can listen from anywhere. It can even be from messages produced from a different app!
@Cyandog
5 ай бұрын
@@mguay whaat?! how does it do that? Do you have any resources about it? Also, do you happen to have a community place like a discord server or anything like that?
Good!
in case where use is registered, and then a gift is sent to the user, but after that we want to make some update on the user, so how do we send data back to the function from where the event is dispatched? any ideas ?
@desmondemojevu
4 ай бұрын
Have you tried emitAsync?
Did it hurt when you fall? I'm talking about that time god sent you to the earth from the sky, CUZ YOU ARE A GODDAMN ANGLE!
This is amazing Michael! regarding scaling and fault tolerance, as the schedule registry is in memory, how would you handle distributing this? would you consider making a vid about this?
@mguay
11 ай бұрын
Hey thanks. The recommended approach for distributing this is to use something like BullMQ. Check out my channel for a video on that. github.com/nestjs/schedule/issues/28
Thank you for this amazing video. Quick question Michael, how should one decide whether or not to use Events or Queues?
I wondering how we can prevent overlapping cron? I search so many topic on SO but still can't find a solution :(
I got one question, you said that this event in async mode is send to the separate thread. I think it is not true. Js is single threaded, also node (without some internal apis from Libuv) but the EventEmitter is build in javascript and works in sync manner. I know that nest js is using event emmiter 2 that is async aware but anyway it is not handled in separate thread. If Im wrong please correct me, Im trying to solve the misery how this emitter works in Nest and the async manner is purely described even in official event emmiter 2 docs.
Can I use events for notification like while user fill up the form that will notify the admin through event?
Omg. Its so good video!
I am a php developer (laravel) and i have to admit it, i was pretty skeptical about node (not this framework, node in general). It seems cool and your video are very clear. What i really don't like is that the cose is quite confusing. In controller you can have http handler (post, get,...) and events handler. I think this can cause messy code very faster than other framework, and the unmessy behavior is demanded to the developer.
@samuelvalentine7846
Жыл бұрын
😂.. well, it's opinionated.. every framework has its downsides.. a downside for me might be an advantage for you
@giacomogaravaglia6742
Жыл бұрын
@@samuelvalentine7846 attitude says all!
Great video Michael! Trying to reproduce the events in one of my projects, I encountered a problem... The event is only emitted once, but the OnEvent listener is firing twice. Any idea why??
can you make a video on queue with bulljs
@esdegan7176
Жыл бұрын
+1 cmon buddy
Please tell me: what theme are you using? I love those colors
Cool stuff. Is `Emit` stuff more like a message-queue stuff? You know, celery in Python.
Awesome content! Btw which font do you use?
@mguay
Жыл бұрын
Material!
Any tips on managing cron like processes on multiple instances? been using bull repeatable jobs but it's feels a bit janky.
@mguay
2 жыл бұрын
I plan on making a video in the future. I would think Bull would be a good candidate since it can be backed by a distributed Redis store, but I haven’t tried it yet so maybe it’s not so great like you point out.
@2penry2
2 жыл бұрын
@@mguay It works ok it just doesn't have the great dev UX those @Cron decorators. Thanks for all the video's found the ones you did on testing on nest.js really helpful!
@z911empire
2 жыл бұрын
The Bull repeatable jobs integration is definitely janky, but it does work
@danielguldbergaaes6432
Жыл бұрын
I guess it depends on the deployment. If it is a kubernetes stack you could simply make a cronjob which will make a fetch and the load balancer will make sure it only is executed once.
Thanks bro
any different when comparing to use kafka
@mguay
2 жыл бұрын
They can both be used to implement an event-driven approach, but i think Kafka is more sensible for processing large quantities of messages for performance reasons - as it allows a distrubted system, and other reasons like fault tolerance, etc.
What if container in cloud gets killed ?
@mguay
Жыл бұрын
Great question. Check my latest video on BullMQ
👇 𝔭𝔯𝔬𝔪𝔬𝔰𝔪