/// <summary> /// The one entry point, this is where requests should be sent /// </summary> public void AddJob(IJobRequest jobRequestObj) { // queue the object and notify the threadProc that there's work to do RequestQueue.Enqueue(jobRequestObj); QueueProcessHandle.Set( ); }
void ThreadProc( ) { while (true) { QueueProcessHandle.WaitOne( ); // while there are requests pending, process them while (RequestQueue.IsEmpty == false) { // get the web request out of the queue IJobRequest requestObj = null; RequestQueue.TryDequeue(out requestObj); //yank it out if (requestObj != null) { // execute it requestObj.ProcessRequest( ); } } } }
private static void FillDataMap(JobDataMap jobDataMap, IJobRequest request) { jobDataMap.Put("data", JsonConvert.SerializeObject(request)); }
public void Load(JobRequest jobRequest) { _jobRequest = jobRequest; _synchronization = new ProtocolSynchronization(); _synchronization.Initialize(); }