0

What are the possibilities to queue messages and store them from main application and then do something with those queued messages every 30 minutes.

Application sends emails out everytime 1 of many components is giving a warning and when many are giving warnings then sometimes 7-10 emails are sent out at once.

I want to queue those warning messages, remove duplicants and send email every 30 minutes if needed.

As extra info this application has no database.

Is storing them in some .txt file and then running method with cron jobs great approach? After running the method, then cleaning out .txt file.

  • What are the variations in these warning messages? I mean how many different types of warning messages are possible? Are these different for each component or they can be common warning message text for various components? Thanks – Alok Jun 12 '17 at 12:49
  • I would use AWS SQS. Next question? – Neil Jun 12 '17 at 12:49
  • There are many components attached to system. Printers, many different sensors and so on –  Jun 12 '17 at 12:52
  • How about variations in warning messages since you mentioned about removal of duplicates? – Alok Jun 12 '17 at 12:58
  • There are some common messages and there are some that are different. I want to group them and send 1 email. –  Jun 12 '17 at 13:01
  • I'd close this as a duplicate of many similar questions, e.g. https://stackoverflow.com/questions/44235068/how-to-run-background-tasks-in-asp-net – Wiktor Zychla Jun 12 '17 at 13:12

1 Answers1

0

Given that you would like to send a single email for various warning messages that have occurred in last 30 minutes and application do not have any database, you can push the messages in the file as they occur, while pushing the messages to file, you can check if it is already present (this can be done by using a unique id associated with each warning message, and if it is already present, you can avoid writing it again to the file. My recommendation would to be make use of XML file instead of plain text file as it is much easier to search a node in XML.

Once 30 minutes are over, the scheduled job can make a copy of the file and clear out the existing original file. Making a copy is useful so that any new warning messages can be immediately written to the original file. Then a single email can be sent with all messages in that copied version of the file. Once the email is sent, remove the copied version as good house keeping.

Thanks

Alok
  • 368
  • 3
  • 13