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
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!
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
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.
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?
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 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 ♥️
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 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".
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?
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.
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.
@@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.
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?
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
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!
@@danyipeti Glad I'm delivering 💪 If you need any help with Quartz, shoot me an email.
your upload time is perfectly inline with my dinner time, i can eat while watch your video. thank you for quartz topic
bon appétit! 😁
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
Huh. Is that a community contribution?
Great Tutorial!
Thanks!
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.
Great suggestion!
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?
If you can schedule-send then it makes sense
@@MilanJovanovicTech Is that one of the benefits of using background jobs? They can be easily scheduled?
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!
Assuming they connect to the same database, that will work without too many isues
@@MilanJovanovicTech Yes, we can consider using the same database.
Hi Milan,
I hope that you create a video about analyzer in the future
Which analyzer?
@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 ♥️
Hi Milan, thanks for this!
How are you able to see the values of the variables while in debug mode? Like in 14:23
ReSharper
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...
If you find anything on that, do share
@@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".
What if the job has an exception/failed? Does quartz has a retry capability?
Yes, you can decide what will happen - retry / wait and retry / give up, etc.
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?
Yes - remove the trigger
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?
There is the [DisallowConcurrentExecution] attribute
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.
That should not be the case. Are you sure the initial run completes and you have it all properly configured?
Please tell us that your next REST API course will include an audio track in Spanish
Yes
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?
besides the obvious, a job that failed and can't be repeated :D
Yes. Now spawn a thread that will run every 3 hours, or any arbitrary schedule you can think of. Not very practical.
@ 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.
Why not using hangfire?
I like Quartz better, personal preference.
Why using hangfire?
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?
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.
Any particular reason for the preference towards Quartz? Both seem to be able to handle those scenario's well?
@@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.
Lol I saw this video as I'm working on background jobs for a side project 😅
Nice timing!
Has Quartz any UI?
Not that I know of
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.
Send me an email
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?
No, not really
Quartz doesn't look developer friendly. Feel like theres too many moving pieces.
Gives you more control, not a bad thing