title: postgresql - java - wake up application when something in database happens
body: <p>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.</p>
  
  <p>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:</p>
  
  <pre><code>select mail from user where mail_sent = false
  </code></pre>
  
  <p>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?</p>
  
  <p>Cheers!</p>