public static void Execute(Object stateinfo) { BaseFsApp app = (BaseFsApp)stateinfo; app.Execute(); app.SendResult(); }
//process webrequest for incoming static void ProcessRequest(object context) { HttpListenerContext ctx = context as HttpListenerContext; BaseFsApp fsapp = null; try{ if (Tools.DecodeSigParams(ctx.Request.QueryString ["SigParameter"], ctx.Request.Headers ["Authorization"])) { if (ctx.Request.Url.AbsolutePath.Contains("DoubleCall")) { fsapp = new DoubleCallApp(ctx, "DoubleCallApp"); } else if (ctx.Request.Url.AbsolutePath.Contains("VoiceIdentCall")) { fsapp = new VoiceIdentCallApp(ctx, "VoiceIdentCall"); } Queue <IFsApp> .GetInstance().Enqueue(fsapp); return; } ctx.Response.StatusCode = 403; ctx.Response.OutputStream.Write(null, 0, 0); ctx.Response.OutputStream.Close(); } catch (Exception ex) { Logger.Fatal("ProcessRequest", "CreateAppRequest", ex.Message); ctx.Response.StatusCode = 403; ctx.Response.OutputStream.Write(null, 0, 0); ctx.Response.OutputStream.Close(); } }
public static void InvokeFs() { IFsApp obj = new BaseFsApp(); while (!_stop) { while (Queue <IFsApp> .GetInstance().Dequeue(ref obj)) { ThreadPool.QueueUserWorkItem(Execute, obj); } } }