The Easiest Scheduling for Your .NET Applications

2024 ж. 31 Қаң.
66 455 Рет қаралды

Check out my courses on Dometrain: dometrain.com
Get the source code: mailchi.mp/dometrain/73q5eabiehm
Become a Patreon and get special perks: / nickchapsas
Hello, everybody, I'm Nick, and in this video, I will show you how you can implement easy scheduling for any type of .NET application in C#.
Give Coravel a star on GitHub: github.com/jamesmh/coravel
Workshops: bit.ly/nickworkshops
Don't forget to comment, like and subscribe :)
Social Media:
Follow me on GitHub: github.com/Elfocrash
Follow me on Twitter: / nickchapsas
Connect on LinkedIn: / nick-chapsas
Keep coding merch: keepcoding.shop
#csharp #dotnet

Пікірлер
  • I have actually used Coravel in a small project in 2020, but we needed to save the schedule tasks to database so that they’d be loaded if the application is stopped or restarted, so we had to go hangfire

    @rk25412@rk254123 ай бұрын
    • Yes, I agree. I have also used it for small projects. It would be great if we can able to configure the task's from database or appsettings

      @velkumars26@velkumars263 ай бұрын
  • It would be great if you create a video about the mailing feature. Thanks for sharing your knowledge

    @behrad871@behrad8713 ай бұрын
  • It's been Hangfire for me for years now but this looks like something I'd like to try. It looks smooth and intuitive. Thanks for sharing, Nick.

    @oswaldumeh8285@oswaldumeh82853 ай бұрын
  • Sick library! Definitely will check it out. I'm using Quartz with manually written tasks api and config loader. Also SilkierQuartz UI for that

    @alexandersuvorkin4213@alexandersuvorkin42133 ай бұрын
  • Coravel sounds very cool. I will have to give it a try for scheduling. And would love a video on how to also use it as a mailer.

    @pedrosilva1437@pedrosilva14373 ай бұрын
  • Using it for a startup project and it works just fine (maybe with a few tricks)

    @ilyakurmaz@ilyakurmaz3 ай бұрын
  • very happy to know about evey functionaliy, Thanks

    @karansingh-ku7yi@karansingh-ku7yi3 ай бұрын
  • Currently, we use Quartz. But thank you for showing Coravel, I'll try it when I have time. 👍

    @Philippe42460@Philippe424603 ай бұрын
  • Yesterday I faced a problem but then this video solved it. Nice

    @TedFanat@TedFanat3 ай бұрын
  • I have used both Quartz and Hangfire as I have aways needed the ability to cluster for high availablity. If the maintainer added a backplane persistance layer then I think many companies might consider this

    @RicusNortje@RicusNortje3 ай бұрын
    • My company also use both

      @adrianbennett2926@adrianbennett29263 ай бұрын
  • Could of done with this yesterday! Time to add a refactor to the backlog

    @local9@local93 ай бұрын
  • Cool video. Short and on point. Thanks :)

    @dojo85@dojo852 ай бұрын
  • Awesome lib!!! just what I needed for my small pet project :)

    @luizrsjr10@luizrsjr102 ай бұрын
  • Now I don't have to go searching for a scheduler. Thanks Nick

    @kennismaduka1728@kennismaduka17283 ай бұрын
  • Hi nick, I love your videos and the way you teach. Do you have an in-depth course on ASP NET I can take part on? My main problem with most online courses and youtube tutorials is that those don't teach you how to structure an app for production, how to properly structure the database access, handle secrets, scaling, logging, monitoring, deployment and all that fun stuff. I know the basics, but now I want the in-depth profession info. I'd love an course/tutorial on that!

    @leobottaro@leobottaro3 ай бұрын
  • Thanks Nick! Great video as always. For database saving purposes I guess it should be possible to capsulate a scheduler database schema based on ones requirements and create the Coravel schedulers on runtime based on this database records. I am more interested in how the task management works in the background. Is it like creating a single timer that ticks every n milliseconds and find any scheduled task that is due, or is it creating one independent timer per task? And also how is the memory management if I have too many (say 10000) scheduled tasks around? Well, time to experiment and figure out!

    @MetehanG@MetehanG3 ай бұрын
  • We use hangfire as we need to store the schedules in the database. We have this ui to let users create their schedule, let hangfire deal with all the timezone shifts to dst and from dst.

    @wabriones276@wabriones2763 ай бұрын
  • Dang, I literally was looking for a good scheduler the other day. This seem very interesting and honestly the biggest thing I'm interested in is being able to re-schedule things at runtime. Was skeptical about this being useful at the start of the vid, but the fact that you can inject a scheduler and prevent overlaps, looks very damn good

    @antonzhernosek5552@antonzhernosek55523 ай бұрын
  • Nice package. I was using Quartz (at least till today)

    @mwi1536@mwi15363 ай бұрын
  • Azure function with timer trigger is a good alternative also

    @xtazyxxx3487@xtazyxxx34873 ай бұрын
  • Awesome - clear and simple. Question - how would you deploy this to Azure?

    @eugenestein1629@eugenestein1629Ай бұрын
  • Will you cover the overlapping with an example? Thank you!

    @oleglang5750@oleglang57503 ай бұрын
  • Interesting, I never heard of that Coravel scheduler. I generally just go with Hangfire. Curious about a more in-depth video about this scheduler, like how does it persist it's jobs, does it remember the last time it ran if you reboot, etc

    @ronsijm@ronsijm3 ай бұрын
    • Nick mentions that there is no persistence.

      @nitrovent@nitrovent3 ай бұрын
    • My goto is also Hangfire, combine it with hangfire.console and hangfire.console.extensions and it works great, but this seems a bit more lightweight and could have its uses when the application dosen't need all the functions of hangfire.

      @Petoj87@Petoj873 ай бұрын
    • Hangfire is also my goto libarary, i guess persistance is yery often needed (also in my cases)....

      @aemarco@aemarco3 ай бұрын
    • HangFire is such crap. I’ve had so many instances of setting a cron string to empty and it won’t remove the database entry. Then if with code to register my background process commented it still runs them because it uses database stored entries that weren’t cleared to use reflection to run the process. It’s so frustrating.

      @stephenyork7318@stephenyork73183 ай бұрын
    • @@stephenyork7318 if it's most people's go to scheduler and you're having huge issues with it, it doesn't really sound like it's the schedulers fault... What library do you use instead then?

      @ronsijm@ronsijm3 ай бұрын
  • Is it just for simplicity of use? Or does it have better performances than a background service checking the time?

    @TheAisoen@TheAisoen3 ай бұрын
  • It's a nice solution as long as you only ever have one instance of the app doing the scheduling. There no coordination across instances to do things like prevent overlap

    @cdarrigo@cdarrigo3 ай бұрын
    • This would be a good subject for @nickchapsas for a future video ! I too need something simple and moderne to handle this.

      @DasBloch@DasBloch3 ай бұрын
    • I rolled my own and needed distributed concurrency managing as well. Used Distributed Lock library to help with this.

      @cheesypufs@cheesypufs3 ай бұрын
    • I was about to write that

      @serus164@serus1643 ай бұрын
  • More on this library please

    @woaksie@woaksie3 ай бұрын
  • I rolled my own scheduler for the application I work on, but mainly because I needed event scheduling rather than just simple task scheduling

    @SG_01@SG_013 ай бұрын
    • Event scheduling?

      @1Eagler@1Eagler3 ай бұрын
    • That just sounds like you needed a regular service bus like MassTransit

      @sinan720@sinan7203 ай бұрын
    • Yeah, like how you schedule events on a calendar. Create a series that starts at date X and lasts until Y, lasting a week and repeating every month kind of deal. Then receive callbacks to start and end, and potentially on application startup while it's going on.

      @SG_01@SG_013 ай бұрын
  • Hi Nick, love your videos. I have a question. How do you go about scheduling in an load balanced environment? Assume you have multiple services configured in an active/passive manner behind a load balancer. How do you allow only one service to kick off scheduling, but also still support failovers? Thanks man.

    @kevinlloyd9507@kevinlloyd95072 ай бұрын
  • Even this is a nice package, things like this are super simple to make with async code. If we go back 20 years and the hassle it was to do multi threading for sure it would be nice with some package like this.

    @ErnaSolbergXXX@ErnaSolbergXXX3 ай бұрын
  • Nice!

    @mirkogeffken2290@mirkogeffken22903 ай бұрын
  • How do you do that ? I was at the moment discussing with my bad about background tasks and a scheduled problem

    @porcinetdu6944@porcinetdu69443 ай бұрын
  • Unfortunately storing state in database is important. This is because our application runs in multiple instances. Number of instances is not known in advance. We have to coordinate this instances and database seems to be good for this purpose.

    @robsosno@robsosno3 ай бұрын
  • used coravel in one of corporate projects and it fits nicely as a very lightweight job scheduler that accepts cron expressions. If us want to use more advanced stuff with scheduling (more user friendly like having UI) i would for sure switch to Hangfire. One downside of coravel as i remember is that issue when coravel can't resolve properly dependencies he silently skips this fact and u can end with not having executed your job logic.

    @dev-on-bike@dev-on-bike2 ай бұрын
  • What’s the benefit of this over Quartz

    @metaltyphoon@metaltyphoon3 ай бұрын
  • Is there any cleanup logic or OnStop event fired when web service is stopped?

    @tosunabi1664@tosunabi16643 ай бұрын
  • What’s a practical example of when you would inject a scheduled task interface into an api endpoint to run something periodically? I can’t see why that would be a thing, your endpoint should finish quickly.

    @stephenyork7318@stephenyork73183 ай бұрын
  • Could you maybe compare this with Hangfire?

    @PanSmierciYT@PanSmierciYT3 ай бұрын
  • How can I stop a scheduler? Fox example, is start a scheduler, when the user logs out to send him a mail, that a product is in the basket. But this only for one week.

    @andreaskarz@andreaskarz3 ай бұрын
  • Nice video. Btw, Coravel's UI is paid. Quarts and Hangfire its free.

    @sachethana@sachethana3 ай бұрын
    • Hangfire has like 3 levels of paid tiers for Startups, Businesses and Enterprises.

      @nickchapsas@nickchapsas3 ай бұрын
    • @@nickchapsasyou have most (if not all) of the features you demonstrated for this package in the free version of hangfire, plus, with the latter you get persistent jobs and a nice dashboard to manage tasks outside your application

      @yunietpiloto4425@yunietpiloto44253 ай бұрын
  • It looks nice and intuitive, but web applications on many hosts, especially shared hosts, stop and start quite often, so it doesn't feel like this would be reliable for e.g. daily tasks if it cannot resume. But for applications you have full control over that they are running, I guess it could work.

    @HugRunner@HugRunner3 ай бұрын
  • I guessed the right thing when I saw "easiest" in the title. I have been using it in my projects for 2 years it works flawlessly. But I don't recommend its cache library as it is not useful and doesn't refresh unless you flush it.

    @notreadonly@notreadonly3 ай бұрын
  • Hangfire is a lot better (at least for free) due to it saving the jobs and queue in the database. Coravel does do a good job with naming and setup though

    @Zorxh@Zorxh3 ай бұрын
  • can we add a schedular in asp core web app as well ?, your valuable suggestion is truly appreciated

    @MrFreedomExpress@MrFreedomExpress2 ай бұрын
    • Look at second example at 7:48

      @krccmsitp2884@krccmsitp2884Ай бұрын
  • I still think Hangfire is much better for most of the usecases unless we're only dealing with fire and forget tasks in something like a console application

    @alirezanet@alirezanet3 ай бұрын
  • What if you have many instances of the same service

    @trukeis856@trukeis8563 ай бұрын
  • Does it also have any storage? Because otherwise it wouldn't be that much usefull. An Scheduler must have an storage to save all schedules in case the app is restarted.

    @Chris-zb5nm@Chris-zb5nm3 ай бұрын
    • That would be a good pull request 😉

      @italofernandes6402@italofernandes64023 ай бұрын
    • Pro version of this library has a storage

      @antonmartyniuk@antonmartyniuk3 ай бұрын
  • Why are timers not good enough? But I actually prefere external triggering.

    @_miranHorvat@_miranHorvat3 ай бұрын
  • how to handle this with distributed containers?

    @fritzfahrmann4730@fritzfahrmann47303 ай бұрын
  • Looks nice, but the good old System.Timer is pretty enough for me. 🙂

    @miroslavmakhruk4102@miroslavmakhruk41023 ай бұрын
  • If i lost my pod connection thats it all tasks gone, need quartz for it for real. Any advice for quartz similar systems? Thanks.

    @selmangulmez6476@selmangulmez64763 ай бұрын
    • Yes, use Hangfire

      @nickchapsas@nickchapsas3 ай бұрын
  • Personally would rather just use Hangfire. This library seems to be charging for persistence support, while Hangfire has it out of the box. If you want to run jobs on a single machine, use the Hangfire memory storage abstraction.

    @andyb012345@andyb0123453 ай бұрын
  • so, if it does not support sharing database, I could not apply this in out scaled apps, right?

    @viniciusmendonca7727@viniciusmendonca77273 ай бұрын
    • You can use cron to configure in the db and pass to the cron function.

      @T___Brown@T___Brown3 ай бұрын
  • What benefit does this have over say hangfire

    @lukebennett3189@lukebennett31893 ай бұрын
    • They seem like different use cases. Hangfire is persistent and distributed, this library is neither. If you just want some process within your service to run every hour then hangfire is very overkill for that

      @maskettaman1488@maskettaman14883 ай бұрын
  • I was loving this video until you said it doesn't have a database to store the schedules. That's a deal breaker for me unfortunately. I'm using Quartz at the moment, happy with it but the fluent API on this looked easier and more flexible. I need the schedule/events to be stateful though and survive a process shut down, my events need to run for months/years in some cases.

    @markrobinson5420@markrobinson54203 ай бұрын
  • Didn't seem to be every two seconds though?

    @richarddeoude2572@richarddeoude25723 ай бұрын
    • I think it was video lag or compression

      @T___Brown@T___Brown3 ай бұрын
  • I don't like that they added an `IMailer`; it has nothing to do with scheduling. Do one thing, and do it right. Make another library - or a sub-package - if you want more stuff.

    @modernkennnern@modernkennnern3 ай бұрын
    • It actually *is* a separate NuGet package.

      @krccmsitp2884@krccmsitp2884Ай бұрын
    • @@krccmsitp2884 oh. Fair enough then ^^

      @modernkennnern@modernkennnernАй бұрын
  • If only Windows had a built-in scheduler that already did all of this with proper logging, etc... We could call it like "Windows Task Scheduler" or something.

    @hobbit125@hobbit1253 ай бұрын
    • Agreed. I don't see how this scheduler is needed. What happens when you need to modify the schedule?

      @kimandjasoninflorida@kimandjasoninflorida3 ай бұрын
    • That would be counter-productive since .NET Core is meant to be OS-agnostic.

      @krccmsitp2884@krccmsitp2884Ай бұрын
  • Hangfire is better, this is only for small things.

    @zabralex85@zabralex853 ай бұрын
  • First🎉

    @Th3MoL3@Th3MoL33 ай бұрын
  • Holy sh** get out of my head! Stop reading my thoughts...

    @mad_t@mad_t3 ай бұрын
KZhead