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.expressions.Expr;
10  import org.mule.api.annotations.param.Payload;
11  
12  import java.util.concurrent.atomic.AtomicInteger;
13  
14  import org.apache.abdera.model.Entry;
15  import org.apache.abdera.model.Feed;
16  
17  public class EntryReceiver
18  {
19  
20      private AtomicInteger receivedEntries = new AtomicInteger(0);
21  
22      public void processEntry(@Payload Entry entry, @Expr("#[header:invocation:feed.object]") Feed feed) throws Exception
23      {
24          System.out.println("Received " + receivedEntries.incrementAndGet() + " of " + feed.getEntries().size() + " entries");
25      }
26  
27      public int getCount()
28      {
29          return receivedEntries.get();
30      }
31  
32      public AtomicInteger getReceivedEntries()
33      {
34          return receivedEntries;
35      }
36  }