I am implementing a J2EE application that has an expiry-style license, and I would like to send e-mail notification to different customers as the customer's license approaches expiry. I'd like to be able to do something like notify at, for example, 90/60/30 days until expiry, but obviously I don't want to accidentally send repeated notices if the query for licenses nearing expiry results in the same set.
The only way I can think of is to have something stored alongside the license key to indicate the last notification date (or the next notification date).
i.e. Company A, license string, expiry: 2010-09-16, next notification: 2010-08-30
Is there a better way to do this that I'm not thinking of?
I'd like to come up with a more generic way of scheduling time-based events (30 days until X happens) for other elements as well, so if I can avoid adding a 'next notification time' to a couple tables in the database, I'd opt for that.
I can use Quartz, if that'd help. I've used it before, but only with the RamJobStore, so nothing was persisted between restarts.