I have a client application that scrapes data into a raw table. This client application makes an asynchronous call to a stored procedure that actually parses the raw data into tables. This processing is handled by a stored procedure. That stored procedure can take up to a half hour to run. We want the client application calling the stored proc to exit and completely stop running. As soon as we kill the client application that calls the stored proc the stored procedure quits executing.
What is the best way to acheive this? I do not want to run a job on the server. I want the client application to trigger this processing. A database trigger (my first idea) didn't solve the problem either because it doesn't consider the insert complete until the stored procedure the trigger is calling is complete.
Here is the Async method. I'm using LINQ. Can I somehow modify this? Or do I need a new design altogether?
partial class MetaDataContext
{
delegate int Process_CompleteCycle2Delegate(int? frequencyID, int? cycleID);
public void Process_CompleteCycle2Async(int? frequencyID, int? cycleID)
{
Process_CompleteCycle2Delegate completeCycleDelegate = new Process_CompleteCycle2Delegate(this.Process_CompleteCycle2);
IAsyncResult async = completeCycleDelegate.BeginInvoke(frequencyID, cycleID, null, null);
}