title: Java + Ms SQL Server 2008 R2 after insert trigger notification
body: <p>I need to write web application using java webgui Vaadin Framework which will be real-time updated with new records inserted to MsSQL database by MsWin2k8R2 NPS.</p>
  
  <p>Since NPS stores logs to files and/or DB, I prefer DB, but I'd like to know how my java program can be notified by SQL server when NPS server inserts data to database and then re-fetch or extract from SQL server notification and display it in browser.</p>
  
  <p>I already have Java&lt;->Ms SQL connection established.</p>
  
  <p>What I already know:</p>
  
  <ul>
  <li>SqlDependency class could be used but it is only for .NET and I'm working in Java</li>
  <li>SQL Server Service Broker - this is some kind of a feature in SQL Server which can be used for this but I currently don't understand correctly how to do it and what it really is</li>
  <li>SQL Extended Events - same as above</li>
  <li>SQL Notifications - same as above</li>
  <li>SQL CRL Triggers - trigger written in C++, C# or maybe in Java which is executed on specified situation but this is done synchronously and will slow down whole operation</li>
  </ul>
  
  <p>Now. I've found this post:
  <a href="https://stackoverflow.com/a/534831/1235977">https://stackoverflow.com/a/534831/1235977</a></p>
  
  <blockquote>
    <p>I would suggest having a trigger on the table that calls the SQL Server Service Broker, that then (asynchronously) executes a CLR stored procedure that does all your work in a different thread.</p>
  </blockquote>
  
  <p>But I don't know how to do this.</p>
  
  <p>So what I need is:
  Simple table in SQL Server which when inserted data into will notify my Java program somehow. It can be using REST web services, JMS or anything what is language independent.</p>
  
  <p>Please provide step by step examples/solutions.</p>