Nest.js | Events & Task Scheduling Tutorial

Sdílet
Vložit
  • čas přidán 9. 07. 2024
  • 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/mguay22/nestjs-eve...
    Nest.js Events: docs.nestjs.com/techniques/ev...
    Nest.js Tasks: docs.nestjs.com/techniques/ta...
    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.dev/udemy/
  • Věda a technologie

Komentáře • 50

  • @mguay
    @mguay  Před 5 měsíci

    Get my highly-rated Udemy courses at a discount here: michaelguay.dev/udemy/

  • @princeigwe8206
    @princeigwe8206 Před 2 lety +1

    I just subscribed to your channel because of this, man. I love it.

  • @williamx0
    @williamx0 Před 2 lety

    Thanks! Great as always!

  • @jesseneon1896
    @jesseneon1896 Před rokem +1

    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.

  • @alexandervasilenko7773

    Cool! Thanx a lot, bro! Info as always useful!!

  • @chess4964
    @chess4964 Před 2 lety +2

    Nestjs is so cool !! My company has a plan on switching to nestjs. Thanks for these contents man!

  • @dawid_dahl
    @dawid_dahl Před rokem

    Thank you for making actually useful videos and not just how to create a todo or something.

  • @gulsharangoraya6707
    @gulsharangoraya6707 Před 2 lety +9

    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
      @gulsharangoraya6707 Před 2 lety

      I hope you are planning to include a tutorial on how to deploy them on AWS. 🤞😇

  • @21Blankenship
    @21Blankenship Před rokem +1

    This was a really good video

  • @kirakira160
    @kirakira160 Před 2 lety +1

    You are best backend developer bro💪🤩

  • @nolw.7805
    @nolw.7805 Před 11 měsíci

    Omg. Its so good video!

  • @Khalil.WebDev
    @Khalil.WebDev Před 4 měsíci

    Impressive tutorial 😊
    Subscribed ✅

  • @waldomalave3126
    @waldomalave3126 Před 2 lety +2

    You're the best bro. I love your videos

    • @mguay
      @mguay  Před 2 lety +1

      I appreciate that!

  • @gbengacodes
    @gbengacodes Před 11 měsíci

    Thank you for this amazing video. Quick question Michael, how should one decide whether or not to use Events or Queues?

  • @ramonbsales
    @ramonbsales Před 5 měsíci

    Good!

  • @EmmanuelOdii80
    @EmmanuelOdii80 Před rokem

    Thanks bro

  • @tom_c
    @tom_c Před rokem

    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??

  • @sagar7929
    @sagar7929 Před 2 lety

    Can I use events for notification like while user fill up the form that will notify the admin through event?

  • @Cyandog
    @Cyandog Před 3 měsíci

    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
      @mguay  Před 3 měsíci +1

      We can listen from anywhere. It can even be from messages produced from a different app!

    • @Cyandog
      @Cyandog Před 3 měsíci

      @@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?

  • @patrykkowalski1305
    @patrykkowalski1305 Před rokem

    Please tell me: what theme are you using? I love those colors

  • @ryanisthewind
    @ryanisthewind Před rokem +1

    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!

  • @trale2431
    @trale2431 Před 2 lety

    I wondering how we can prevent overlapping cron? I search so many topic on SO but still can't find a solution :(

  • @jrs_devs
    @jrs_devs Před 2 měsíci

    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?

  • @user-xj8wj7pt8o
    @user-xj8wj7pt8o Před 9 měsíci

    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
      @mguay  Před 9 měsíci +1

      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

  • @shadow16810
    @shadow16810 Před rokem

    Awesome content! Btw which font do you use?

  • @michaelyao9389
    @michaelyao9389 Před 2 lety

    Cool stuff. Is `Emit` stuff more like a message-queue stuff? You know, celery in Python.

  • @jakubpiecyk4464
    @jakubpiecyk4464 Před 9 měsíci

    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.

  • @lumgashi3076
    @lumgashi3076 Před 4 měsíci

    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 ?

  • @giacomogaravaglia6742

    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
      @samuelvalentine7846 Před rokem

      😂.. well, it's opinionated.. every framework has its downsides.. a downside for me might be an advantage for you

    • @giacomogaravaglia6742
      @giacomogaravaglia6742 Před rokem

      @@samuelvalentine7846 attitude says all!

  • @2penry2
    @2penry2 Před 2 lety

    Any tips on managing cron like processes on multiple instances? been using bull repeatable jobs but it's feels a bit janky.

    • @mguay
      @mguay  Před 2 lety +3

      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
      @2penry2 Před 2 lety

      @@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
      @z911empire Před 2 lety

      The Bull repeatable jobs integration is definitely janky, but it does work

    • @danielguldbergaaes6432
      @danielguldbergaaes6432 Před rokem

      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.

  • @huththo
    @huththo Před 2 lety +3

    can you make a video on queue with bulljs

  • @wayneyu3031
    @wayneyu3031 Před 2 lety

    any different when comparing to use kafka

    • @mguay
      @mguay  Před 2 lety +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.

  • @Trooperos90
    @Trooperos90 Před rokem

    What if container in cloud gets killed ?

    • @mguay
      @mguay  Před rokem

      Great question. Check my latest video on BullMQ

  • @Dave-hu9wf
    @Dave-hu9wf Před 2 lety

    👇 𝔭𝔯𝔬𝔪𝔬𝔰𝔪