1
votes

I am using Azure WebJobs to clean records from my database 48 hours after I have added them. The WebJob is always listening onto a message queue (also on Azure) which will contain a message that specifies which record to delete.

I add record to the DB though my C# MVC application. I wish to use the Azure scheduler to push a message onto the Queue 48 hours after I have added the record. I can't seem to find a way how to schedule these tasks automatically through my MVC. Is this possible ? I have found ways to call an already configured scheduled job , but I need to create these jobs when I add the records, so that record specific information is passed to the scheduler body.

3
you can use scheduler REST API to create jobs programmatically..Check thisshwetaOnStack
@shwetaOnStack:i have created one demo as specified on this azure.microsoft.com/en-in/documentation/articles/… how do i know whether this task has run or not??Learning-Overthinker-Confused

3 Answers

1
votes

I add record to the DB though my C# MVC application. I wish to use the Azure scheduler to push a message onto the Queue 48 hours after I have added the record.

One way to achieve this is to immediately push the message in the queue but keep it invisible for 48 hours through a property called initialVisibilityDelay when adding message to a queue. Will that be an acceptable solution?

1
votes

Other option would be that instead of doing an continuously WebJob listening to a queue, it could be a WebJob in scheduled mode, checking for items for example in Azure Table Storage if there some jobs to do and if those jobs are 48 hours old.

1
votes