views:

23

answers:

1

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.

+1  A: 

If you are going to send notification exactly at 90/60/30 days until expiry date, how it is going to be repeated notices?

Are you doing notification within app like popup during app startup or as a separate remote process that sends like email notification? If it is within app, you can always simple checks during app startup

Harsha Hulageri
What I mean is, let's say that I send a notice for Company A on September 2nd because its license expires in 90 days. Then, for whatever reason, the app is restarted, and it comes back up, does its periodic check, finds that Company A's license expires in 90 days. As far as I can see, I have to store something to indicate the 90 day notice was already sent to them. I was just asking if there was a better way than what I could think of.
Shawn D.
In that case your approach seems to be appropriate. It has to be stored somewhere to track
Harsha Hulageri