I have written a Java application which should be started or woken up when 'something' happens in the database. For example an insert into the user table should trigger the sending of the usual welcome, password, ... mails.
What is the best common practice to do this? I can write my application such that it executes the following query let's say every second:
select mail from user where mail_sent = false
But this is polling, and I would like to avoid it. Is there a way to start or wake-up my Java application (push) initiated by a change in the database?
Cheers!