title: Pub/Sub How to notify users logged in a subscriber application?
body: <p>I know the pattern pub/sub in theory and now I would like to implement it in practice.</p>
  
  <p>I have a web application (subscriber) that contains a service that is listening for a channel called "news". This channel is populated by a list of other applications (publishers).</p>
  
  <p>So, I would like to know, how to notify the logged user about the news received in real-time. (something like twitter "new twitts" does).</p>
  
  <p>What I think:</p>
  
  <p>in my consumer service I can store the news received in a List, something like:</p>
  
  <pre><code>@Consumer("myChannel")
  public void recNews(New new) {
      allNews.add(new);
  }
  </code></pre>
  
  <p>And then, configure a timer in my application to read and reset that List and send the current status (lastNews) to my web-controller:</p>
  
  <pre><code>@Timer("1 per minute")
  public void lastNews() {
      lastNews.add(allNews);
      allNews = new ArrayList();
  }
  </code></pre>
  
  <p>Am I right? Or is there a better solution ?</p>