The Best Way to Implement Long Running Tasks in .NET - Hangfire, Blazor, SignalR

  Рет қаралды 14,810

Milan Jovanović

Milan Jovanović

Күн бұрын

Пікірлер: 37
@MilanJovanovicTech
@MilanJovanovicTech 6 ай бұрын
Get the source code for this video for FREE → the-dotnet-weekly.ck.page/long-running-tasks Want to master Clean Architecture? Go here: bit.ly/3PupkOJ Want to unlock Modular Monoliths? Go here: bit.ly/3SXlzSt
@baranacikgoz
@baranacikgoz 6 ай бұрын
Excellent video, excellent approach. I love comparisons showing improvements one by one
@MilanJovanovicTech
@MilanJovanovicTech 6 ай бұрын
Awesome, glad you enjoyed it 😁
@Curlack
@Curlack 6 ай бұрын
Would really love to see how to implement a cancel button utilizing the CancellationToken. Also monitoring multiple requests from the same button or even keeping it disabled 'till cancelled or completed. Those are the parts I usually croak 😅. Good job dude!
@MilanJovanovicTech
@MilanJovanovicTech 6 ай бұрын
Huh, that would've been interesting. Maybe in a future video. The cancellation token would only make sense in the blocking scenario.
@Jamabaiz
@Jamabaiz 6 ай бұрын
​@@MilanJovanovicTechor in the hangfire job, if it is processing via loop, it could check cancelation token state from singleton service. User could then send request to trigger cancelation token using other endpoint which would inject this singleton service.
@vscode-runaways
@vscode-runaways 4 ай бұрын
@@MilanJovanovicTech IMO also in none blocking situations, what if you generate a n report and after a while you decide to cancel the job
@xaloiqq
@xaloiqq 6 ай бұрын
Nice video. I think it would be a good idea to show the network tab on developer tools to explicitly show request being made in polling and signalR solutions. Keep the good work man :)
@MilanJovanovicTech
@MilanJovanovicTech 6 ай бұрын
How didn't I think of that? Darn it... Great idea. Didn't even cross my mind. That's how often I work with Ui stuff 😅
@MarcelPopescu
@MarcelPopescu 6 ай бұрын
🎯 Key Takeaways for quick navigation: 00:00 *The video demonstrates three implementations for executing long-running background jobs from a Blazor WebAssembly client.* 00:14 *Version 1: A blocking implementation that waits for the entire background job duration, simulating a 10-second delay.* 04:14 *Version 2: An asynchronous implementation using Hangfire to enqueue a background job and polling the server for job status updates.* 08:24 *The client sends a POST request to enqueue the job, receives the job ID, and periodically polls the server for job status until completion.* 12:47 *Version 3: An asynchronous implementation using Hangfire and SignalR for real-time job status updates from the server.* 15:22 *The client establishes a SignalR connection, and the server pushes job status notifications through the SignalR hub.* 17:25 *Version 3 is more complex but optimizes resource utilization by eliminating unnecessary polling requests.* 17:40 *Additional benefits include the ability to retry failed jobs and resume from the last checkpoint.* Made with HARPA AI
@MilanJovanovicTech
@MilanJovanovicTech 6 ай бұрын
Pretty cool use case for AI
@ZuvielDrama
@ZuvielDrama 6 ай бұрын
Thanks Milan ❤❤❤
@MilanJovanovicTech
@MilanJovanovicTech 6 ай бұрын
Sure thing!
@10Totti
@10Totti 6 ай бұрын
Best tutorial!
@MilanJovanovicTech
@MilanJovanovicTech 6 ай бұрын
Wow, thanks!
@anasmustafa7188
@anasmustafa7188 6 ай бұрын
nice work, which theme you use for vs it make code cleaner
@MilanJovanovicTech
@MilanJovanovicTech 6 ай бұрын
ReSharper
@vscode-runaways
@vscode-runaways 4 ай бұрын
Please if you update this video add a Server Side Rendering variant to it, would be nice to see how to update the WebPage than, please also add Cancel Button to the 2nd and 3rd Szenario
@MilanJovanovicTech
@MilanJovanovicTech 4 ай бұрын
Great suggestion!
@YehorBachurinDev
@YehorBachurinDev 6 ай бұрын
Nice
@MilanJovanovicTech
@MilanJovanovicTech 6 ай бұрын
Thanks!
@amitkumdixit
@amitkumdixit 6 ай бұрын
It's better to use Hangfire dashboard instead
@MilanJovanovicTech
@MilanJovanovicTech 6 ай бұрын
What for?
@coding-in
@coding-in 3 ай бұрын
Hi ​@@MilanJovanovicTech, what's the name feature if we use Quatrz Scheduler? Is it have a feature like that? Thanks for ur every videos!
@shakhriyorakhadov8244
@shakhriyorakhadov8244 6 ай бұрын
Milan your thinking images hitting me up😅
@MilanJovanovicTech
@MilanJovanovicTech 6 ай бұрын
Oh gosh
@yogij17
@yogij17 6 ай бұрын
SignalR doesnt work with load balancer
@MilanJovanovicTech
@MilanJovanovicTech 6 ай бұрын
Or is hard to configure?
@DIoxide-ck8uy
@DIoxide-ck8uy 6 ай бұрын
Hangfire uses a ton of cpu on my dedicated server
@MilanJovanovicTech
@MilanJovanovicTech 6 ай бұрын
A lot of polling
@PankajNikam
@PankajNikam 6 ай бұрын
Is the same possible with Quartz? Thanks for the video.
@MilanJovanovicTech
@MilanJovanovicTech 6 ай бұрын
Not really, I haven't found a way to schedule background jobs on-demand with Quartz. Maybe there is and I'm just a noob, so don't take this at face value.
@PankajNikam
@PankajNikam 6 ай бұрын
@@MilanJovanovicTech Someone would be a fool to call you an amateur :) I too didn't find a way to schedule on demand job with it. I thought maybe Milan knows :)
@Wouldntyouliketoknow2
@Wouldntyouliketoknow2 6 ай бұрын
You can schedule on demand background jobs with "stint". Give it a go, I'd welcome the feedback..
Completely Get Rid of Exceptions Using This Technique
19:24
Milan Jovanović
Рет қаралды 26 М.
Was I Wrong About Blazor? | Coding Shorts 111
16:35
Shawn Wildermuth
Рет қаралды 21 М.
FOREVER BUNNY
00:14
Natan por Aí
Рет қаралды 31 МЛН
I thought one thing and the truth is something else 😂
00:34
عائلة ابو رعد Abo Raad family
Рет қаралды 8 МЛН
The Only .NET Scheduler You Should Be Using!
16:38
Nick Chapsas
Рет қаралды 56 М.
Mastering SignalR: Build Your Own Stock Price Dashboard
21:51
Milan Jovanović
Рет қаралды 21 М.
Modular Monoliths Are The New Microservices
31:08
TaleLearnCode
Рет қаралды 26 М.
Implementing the Transactional Outbox Pattern from Scratch
24:27
Milan Jovanović
Рет қаралды 6 М.
New .NET 9.0 Blazor Features!
9:17
The Code Wolf
Рет қаралды 13 М.
Real-Time Notifications Using Blazor and SignalR from scratch
19:43
Milan Jovanović
Рет қаралды 38 М.
Build a Chat with SignalR & Blazor WebAssembly in .NET 8 🚀
23:01
Avoiding long running HTTP API requests.
7:24
CodeOpinion
Рет қаралды 17 М.