public NotificationQueueMessage Receive() { if (_InProcessDir == null) { throw new ApplicationException( "Must use the 4 parameter contstructor to create a queue object " + "that supports the Receive() method."); } NotificationQueueMessage RetVal = null; int SleepSeconds = 0; while (RetVal == null) { NotificationFile NFile = GetNextNotificationFile(); if (NFile != null) { RetVal = new NotificationQueueMessage(NFile.Id, NFile.Type, NFile.OrderId, ReadFile(_InboxDir + NFile.Name)); File.Move(_InboxDir + NFile.Name, _InProcessDir + NFile.Name); } else { SleepSeconds = SleepSeconds * 2; if (SleepSeconds == 0) { SleepSeconds = 1; } if (SleepSeconds > 30) { SleepSeconds = 30; } Thread.Sleep(SleepSeconds * 1000); } } return(RetVal); }
public void Send(NotificationQueueMessage M) { NotificationFile NFile = new NotificationFile(M.Id, M.Type, M.OrderId); WriteFile(_InboxDir + NFile.Name, M.Xml); }
public void ProcessingFailed(NotificationQueueMessage M) { NotificationFile NFile = new NotificationFile(M.Id, M.Type, M.OrderId); File.Move(_InProcessDir + NFile.Name, _FailureDir + NFile.Name); }
public NotificationQueueMessage Receive() { if (_InProcessDir == null) throw new ApplicationException( "Must use the 4 parameter contstructor to create a queue object " + "that supports the Receive() method."); NotificationQueueMessage RetVal = null; int SleepSeconds = 0; while (RetVal == null) { NotificationFile NFile = GetNextNotificationFile(); if (NFile != null) { RetVal = new NotificationQueueMessage(NFile.Id, NFile.Type, NFile.OrderId, ReadFile(_InboxDir + NFile.Name)); File.Move(_InboxDir + NFile.Name, _InProcessDir + NFile.Name); } else { SleepSeconds = SleepSeconds * 2; if (SleepSeconds == 0) SleepSeconds = 1; if (SleepSeconds > 30) SleepSeconds = 30; Thread.Sleep(SleepSeconds * 1000); } } return RetVal; }
public void ProcessingSucceeded(NotificationQueueMessage M) { NotificationFile NFile = new NotificationFile(M.Id, M.Type, M.OrderId); File.Move(_InProcessDir + NFile.Name, _SuccessDir + NFile.Name); }