public void Scan(FeedReaderQuery feedQuery) { // query var items = _feedQueryHandler.Handle(feedQuery); // filter var newItems = _gotItQuery.GetNewItems(items); if (newItems.Count > 0) { // convert to feedItem is this necessary? var newFeedItems = ConvertToFeedItems(newItems); // add to the command bus Send(newFeedItems); } else { Logger.Info("No new items found"); } }
/// <summary> /// Queries a feed returning the RSS items in a list /// </summary> /// <param name="query"></param> /// <returns></returns> public List <SyndicationItem> Handle(FeedReaderQuery query) { var result = new List <SyndicationItem>(); var rssFeed = new SyndicationFeed(); using (var reader = XmlReader.Create(query.Feed.Url)) { rssFeed = SyndicationFeed.Load(reader); foreach (SyndicationItem sItem in rssFeed.Items) { if ((sItem == null) || (sItem.Title == null)) { continue; } result.Add(sItem); } } return(result); }