View Javadoc

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