View Javadoc
1   /*
2    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
3    * The software in this package is published under the terms of the CPAL v1.0
4    * license, a copy of which has been included with this distribution in the
5    * LICENSE.txt file.
6    */
7   package org.mule.module.atom.event;
8   
9   import org.mule.api.annotations.param.Payload;
10  
11  import java.util.concurrent.atomic.AtomicInteger;
12  
13  import org.apache.abdera.model.Feed;
14  
15  public class FeedReceiver
16  {
17  
18      private final AtomicInteger receivedEntries = new AtomicInteger(0);
19  
20      public void processFeed(@Payload Feed feed) throws Exception
21      {
22          receivedEntries.set(0);
23          System.out.println("Received " + feed.getEntries().size() + " events");
24          receivedEntries.set(feed.getEntries().size());
25      }
26  
27      public int getCount()
28      {
29          return receivedEntries.get();
30      }
31  
32      public AtomicInteger getReceivedEntries()
33      {
34          return receivedEntries;
35      }
36  }