Creating an email notification system based on polling database rows
- by Ashish Sharma
I have to design an email notification system based on the following requirements:
The email notifications would be created based on polling rows in a Mysql 5.5 DB table when they are in a particular 'Completed' state.
The email notification should be sent out in no more than 5 minutes from the time the row was created in the DB table (At the time of DB table row creation the state of the row might not be 'Completed').
Once 5 minutes for the DB table row expire in reaching the 'Completed' state, separate email notification need to be sent (basically telling the user that the original email notification would be delayed) and then sending the email notification as and when the row state reaches to being 'Completed'.
The rest of the system requirements are :
Adding relevant checks to monitor the whole system via MBeans interface.
The system should be scalable so that if the rate of DB table rows creation increases so does the Email notification system be able to ramp up.
So I request suggestions on following lines:
What approach should I take in solving the problem described from a programming/Design pattern point of view?
Suggestion for any third party plugin/software that can be used to solve the problem described?
Points to take care regarding scalability and monitoring the health of the system?
Java is the language of preference but I am open to using off the shelf components that can be interfaced with Java language or provide standard ports for communication.
Currently I do have an in house grown system (written in Java) that is catering to the specified requirements, but it's now crumbling under increased load and now I want to give the problem a fresh look.
thanks in advance
Ashish