com.walmart.openapi
Class DataFeedManager
java.lang.Object
com.walmart.openapi.DataFeedManager
public class DataFeedManager
- extends java.lang.Object
Feed manager lets you iterate over the items in data feeds. We
choose the Iterator pattern because the category feeds/full feeds
for some of the categories are really huge(>1GB)
and cannot be loaded in memory for analysis.
Note : It does not cache the result locally i.e on successive
runs it makes a network call to download the feeds again
from the open api end points.
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DataFeedManager
public DataFeedManager(java.lang.String apiKey)
getFeedIterator
public DataFeedManager.FeedIterator getFeedIterator(DataFeedManager.FeedsType feedsType)
throws java.lang.Exception
- Return the iterator for the entire feed.
Note : Walmart catalog has millions of items.
- Parameters:
feedsType -
- Returns:
-
- Throws:
java.lang.Exception
getFeedIterator
public DataFeedManager.FeedIterator getFeedIterator(DataFeedManager.FeedsType feedsType,
java.lang.String categoryId)
throws java.lang.Exception
- Open a connection to the server, unzip the stream and then create a JsonParser.
- Parameters:
feedsType - Type of feed eg. specialbuys, rollbacks, etccategoryId - category id for which the iterator is requested.
- Returns:
- Returns iterator which supports hasNext() and next() methods to parse the feed.
- Throws:
java.lang.Exception