Hangfire implemetation

最后都变了- 提交于 2019-12-13 02:07:29

问题


i am new to hangfire and looking for the solution which can solve the below case

  1. take the data from the DB and convert this to CSV file. this should happen when ever the user insert the new record,hangfire should fire end of the day if there is new record inserted.
  2. Can we deploy hangfire on the local machine and do the testing

回答1:


take the data from the DB and convert this to CSV file

You can use hangfire to run any public method on any class in your application. So if you write a method which does what you want, then hangfire can call that method:

BackgroundJob.Enqueue<IUserRecordProcessor>(x => x.ProcessRecord());

hangfire should fire end of the day if there is new record inserted

You can schedule hangfire to execute recurrent tasks (see here). However, this execution is not conditional. Instead you should move the conditional logic into the code which hangfire calls:

RecurringJob.AddOrUpdate<IUserRecordProcessor>(x => x.ProcessRecordIfOneExists(), Cron.Daily);

Can we deploy hangfire on the local machine and do the testing

Yes you can.



来源:https://stackoverflow.com/questions/35127008/hangfire-implemetation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!