Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

On scheduled background jobs

185 views

Published on

In C#, there are many ways to perform background tasks. This slides describe one personal experience.

Published in: Software
  • ☀☀☀ https://dwz1.cc/EWG1lhe4
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

On scheduled background jobs

  1. 1. On Scheduled Background Jobs Hasin Technology Co. December 2016 By: Vahid Rahimian Hasin Group: Internal Technical Session 1
  2. 2. Agenda •My Story •Where were we wrong? •HangFire.io 2
  3. 3. My Story • Once we had a problem in CMS: we needed to perform some tasks async, and update UI with their progress • More specifically: we had to personalize 1000*1000 cards, the UI session timed out, while user-retry had bad effects 3
  4. 4. My Story • What Did we do? • Invented The Wheel! • We developed a Task execution engine, passed all parameters to it, making some internal rules on how to pass parameters and how to interpret them 4
  5. 5. My Story • By time, it got more and more complex SELECT [Id] ,[Username] ,[TaskType] ,[SystemName] ,[CreationDate] ,[RealStartTime] ,[FinishDate] ,[InputFilename] ,[InputFilenameAbsolute] ,[CurrentRecord] ,[TotalRecord] ,[Description] ,[State] ,[ValidityDate] ,[InputFileLastModifiedDate] ,[ObjectDataSourceClassName] ,[ReportPersianName] ,[ListDataFunctionName] ,[InputTypeList] ,[InputValueList] ,[ExcelColumnNames] ,[ExcelColumnLabels] ,[ExcelColumnWidth] ,[ExcelZipType] ,[DataContent] ,[CallBackUrl] ,[Enable] FROM [MyketTask].[dbo].[Task] 5
  6. 6. What was wrong? •We did NOT checked the web enough • There was lots of solutions to our generic problem • And I have seen this in technical teams again and again • We have a specific problem, we solve it better than anyone 6
  7. 7. What If … •If we had checked the web enough, we had solved it much more better, and sooner. •Since then, I regularly check some material like • https://github.com/quozd/awesome- dotnet • https://github.com/uhub/awesome-c- sharp 7
  8. 8. HangFire.io • An open-source framework that helps you to create, process and manage your background jobs: • mass notifications; • batch import from xml, csv, json; • creation of archives; • firing off web hooks; • offline image/video processing; • purge temporary files; • recurring automated reports; 8
  9. 9. HangFire.io •There are some considerations: • http://odinserj.net/2014/05/10/are-your- methods-ready-to-run-in-background/ • Let’s see HangFire in action … • Simple Scenario • Persistent Storage • Complex Scenario 9
  10. 10. Any Questions? 10

×