Search code examples
asp.net-mvcbackgroundworker

Incomplete Controller Action job handle


I am working on an asp.net mvc project. From my app I have to export certain entities to another app.

what I do is

1) I export certain entities on a button click

2) after successful export I mark those entities as exported

Now the question is what if before being marked as exported in database browser is closed or network connection interrupted?

3 cases may happen

1) export and database update both are done

2) export may be done and database not updated

3) export and database update both are not done

In case of number 2 &3 i am trapped. so if there would be a background processor for web application it would be helpful and I could always ensure number 1 to happen.

I went through various webbackground job handler like webbackgrounder,hangfire,quartz.ne etc..

But what I saw is they actually are doing scheduled job on a regular interval. And how can I actually do the task from these background handler as if I am doing it in the controller and accessing db .

And in my case can asynchronous controller be another option? And for another console application to run in server many people are discouraging saying that why I am not using available libraries for handling background job


Solution

  • I am using hangfire now and handling the background job smoothly