问题
i am new to hangfire and looking for the solution which can solve the below case
- 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.
- 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