public static MessageDetail Analyze(MessageDetail messageDetail) { // check the messageDetail and decide to retry or long retry // response with modified MessageDetail messageDetail.sendHistory.Add("checked"); return(messageDetail); }
public void Process(MessageDetail messageDetail) { // write message based on template Console.WriteLine(mailType.GetMessageTemplate(messageDetail.content)); // send message via provider MessageDetail respMessageDetail = messageSender.SendMessage(messageDetail.content); MessageDetailAnalyzer.Analyze(respMessageDetail); }
// This method can be exposed as a Rest Method public static bool enqueue(MessageDetail messageDetail) { try{ sira.Enqueue(messageDetail); return(true); }catch (Exception ex) { Console.WriteLine(ex.Message); return(false); } }
public static void Main() { // Init or connect to mail request queue MailQueue.init(); MessageDetail mailContent = MailQueue.peek(); while (mailContent.status != 0) { MailProcessor processor = new MailProcessor(MailTypeSelector.getTypeForMail(mailContent.content), MailProviderSelector.getProviderForMail(mailContent.content)); processor.Process(mailContent); mailContent = MailQueue.peek(); } MailQueue.destroy(); Console.WriteLine("DONE"); Console.ReadKey(); }