Background Jobs With Quartz - Advanced Scheduling, Persistence, OpenTelemetry

Поделиться
HTML-код
  • Опубликовано: 27 янв 2025

Комментарии • 57

  • @MilanJovanovicTech
    @MilanJovanovicTech  14 дней назад +2

    Want to master Clean Architecture? Go here: bit.ly/3PupkOJ
    Want to unlock Modular Monoliths? Go here: bit.ly/3SXlzSt
    Get the source code here: www.patreon.com/milanjovanovic

  • @danyipeti
    @danyipeti 13 дней назад +1

    I have been following you for 2 years. I haven't opened your newsletters since May, because I didn't have much time for those to read. Today I checked all your emails and of course I found one which I'm really interested in, background jobs. Then I searched it on youtube if you posted some guide to it and then baang, first search result is newly uploaded video of background jobs :D Thank you for your work!

    • @MilanJovanovicTech
      @MilanJovanovicTech  13 дней назад

      @@danyipeti Glad I'm delivering 💪 If you need any help with Quartz, shoot me an email.

  • @developmentroselino
    @developmentroselino 14 дней назад +2

    your upload time is perfectly inline with my dinner time, i can eat while watch your video. thank you for quartz topic

  • @antonmartyniuk
    @antonmartyniuk 13 дней назад +1

    Note: there is a Nuget package for EF Core persistence, so you can add corresponding Quartz entity registration in your DbContext OnConfiguring method.
    After you just regularly create migrations and update your database exeucting migrations or exporting them to a single SQL file

  • @10Totti
    @10Totti 14 дней назад

    Great Tutorial!

  • @lucasbran293
    @lucasbran293 12 дней назад

    Hey Milan, great video as always! Could you make a video about how to properly set up Quartz in distributed scenarios? For example, using job persistence and handling multiple pods concurrently trying to execute the same job. Also, how to manage multiple different applications sharing the same DB schema, ensuring each application only executes jobs declared within its own source code.

  • @MagicLevel-c7v
    @MagicLevel-c7v 13 дней назад +1

    Great video, but in production scenarios, don't most applications use some sort of event/bus (i.e service bus) to handle all scenarios where you need to send emails/textmessages etc?

    • @MilanJovanovicTech
      @MilanJovanovicTech  13 дней назад +1

      If you can schedule-send then it makes sense

    • @MagicLevel-c7v
      @MagicLevel-c7v 11 дней назад

      @@MilanJovanovicTech Is that one of the benefits of using background jobs? They can be easily scheduled?

  • @mustafizurrahman4828
    @mustafizurrahman4828 14 дней назад +1

    Hi Milan, great video! Could you please create a tutorial that integrates Quartz with a Clean Architecture approach? I believe Quartz would fit well as part of the Infrastructure layer. Additionally, it would be helpful if you could demonstrate using a separate application to process the jobs, instead of having the job processing within the same API project. Thank you!

    • @MilanJovanovicTech
      @MilanJovanovicTech  14 дней назад

      Assuming they connect to the same database, that will work without too many isues

    • @mustafizurrahman4828
      @mustafizurrahman4828 14 дней назад

      @@MilanJovanovicTech Yes, we can consider using the same database.

  • @CLeovison
    @CLeovison 14 дней назад

    Hi Milan,
    I hope that you create a video about analyzer in the future

    • @MilanJovanovicTech
      @MilanJovanovicTech  13 дней назад

      Which analyzer?

    • @CLeovison
      @CLeovison 13 дней назад

      @MilanJovanovicTech Hi Milan,
      Static analyzer, i watch your minimal api endpoint registration implementation and at the end of the video, you tell that one thing that can be improved in the last minute of the video is to put an analyzer. I try to read the documentation about it on microsoft website but i'm struggling to understand it so, i hope that you create a video about it in the future.
      Thank you so much ♥️

  • @juswa639
    @juswa639 13 дней назад

    Hi Milan, thanks for this!
    How are you able to see the values of the variables while in debug mode? Like in 14:23

  • @math1a5
    @math1a5 13 дней назад

    I think Quartz can even populate the values from JobDataMap to Job's properties automatically. It may be only for the basic types, however, I don't really remember...

    • @MilanJovanovicTech
      @MilanJovanovicTech  13 дней назад

      If you find anything on that, do share

    • @math1a5
      @math1a5 12 дней назад

      @@MilanJovanovicTech Of course my comment with a link has been removed, so I'll just paste the citation from Quartz documentation (it's in the section More About Jobs -> JobDataMaps): "If you add properties with a public set accessor to your job class that correspond to the names of keys in the JobDataMap, then Quartz's default JobFactory implementation will automatically call those setters when the job is instantiated, thus preventing the need to explicitly get the values out of the map within your execute method. Note this functionality is not maintained by default when using a custom JobFactory".

  • @roginroireillo7153
    @roginroireillo7153 5 дней назад

    What if the job has an exception/failed? Does quartz has a retry capability?

    • @MilanJovanovicTech
      @MilanJovanovicTech  4 дня назад

      Yes, you can decide what will happen - retry / wait and retry / give up, etc.

  • @vijayt7954
    @vijayt7954 12 дней назад

    I have scheduled the jobs every 5 minutes but at a certain time I need to stop the jobs,is it possible to stop the jobs?

  • @francopioletti7043
    @francopioletti7043 14 дней назад +1

    Hi Milan. how do you handle having more than one pod or instance of the same aplication running in parallel, if I use a sql database as an store, will it prevent job duplication?

  • @alexnilev7779
    @alexnilev7779 14 дней назад

    Strange behavior with the database storage. If I have a task that runs every 3 hours, the task executes successfully, the service crashes, and upon restart, it starts NOT from the last successful execution from lookup db but from now. As a result, instead of the 3-hour interval, the task runs as many times as the application crashes, breaking the "once every 3 hours" condition.

    • @MilanJovanovicTech
      @MilanJovanovicTech  13 дней назад

      That should not be the case. Are you sure the initial run completes and you have it all properly configured?

  • @maucodev
    @maucodev 13 дней назад

    Please tell us that your next REST API course will include an audio track in Spanish

  • @DavidSmith-ef4eh
    @DavidSmith-ef4eh 13 дней назад

    would it be possible to just spawn another thread and run it in another thread in c#? also, what would be the downsides of this?

    • @DavidSmith-ef4eh
      @DavidSmith-ef4eh 13 дней назад

      besides the obvious, a job that failed and can't be repeated :D

    • @MilanJovanovicTech
      @MilanJovanovicTech  13 дней назад

      Yes. Now spawn a thread that will run every 3 hours, or any arbitrary schedule you can think of. Not very practical.

    • @DavidSmith-ef4eh
      @DavidSmith-ef4eh 13 дней назад

      @ the most common case is to speed up the response to the user though and you don't actually care about delaying it or scheduling it.

  • @Gameraliaz
    @Gameraliaz 12 дней назад

    Why not using hangfire?

  • @thecodeman_
    @thecodeman_ 14 дней назад

    Hi man, an awesome video! Did you try to do the same thing with Hangfire? I know your preferred library is Quartz, why is that the case?

    • @MilanJovanovicTech
      @MilanJovanovicTech  14 дней назад +2

      I prefer the Quartz support for recurring jobs and CRON schedules. Most people go for Hangfire because it has a UI, without really exploring the alternatives.

    • @kwibuske
      @kwibuske 14 дней назад

      Any particular reason for the preference towards Quartz? Both seem to be able to handle those scenario's well?

    • @JollyGiant19
      @JollyGiant19 4 дня назад

      @@kwibuskeFor me, it was that I needed to dynamicly create jobs and schedules at runtime and from what I can see, Hangfire doesn’t do that or at least doesn’t do it as easily as Quartz does.

  • @siya.abc123
    @siya.abc123 14 дней назад +1

    Lol I saw this video as I'm working on background jobs for a side project 😅

  • @CharlesOllavo
    @CharlesOllavo 14 дней назад

    Has Quartz any UI?

  • @sunzhang-d9v
    @sunzhang-d9v 13 дней назад

    Could you please send me a copy of this code? Due to national reasons, it seems I don't have payment permissions. I beg you.

  • @dotnetMasterCSharp
    @dotnetMasterCSharp 14 дней назад

    Hello Milan!
    I'm a software developer and I'm having trouble finding a job. Can you give me a task?
    I would like to test my knowledge accordingly!
    What do you think?

  • @duznt-xizt
    @duznt-xizt 14 дней назад

    Quartz doesn't look developer friendly. Feel like theres too many moving pieces.