Ejemplo n.º 1
0
        /// <summary>
        /// Poll endpoints for new items
        /// </summary>
        private void PollEndpoints()
        {
            PollingEndpoints.ForEach(pollingEndpoint =>
            {
                // get new items from endpoint
                List <T> newItems = pollingEndpoint.Poll();

                // for those items that pass all filters, convert to content
                List <IContent> contentToProcess = new List <IContent>();
                newItems.ForEach(newItem =>
                {
                    if (PollingFilter.PassesFilter(newItem))
                    {
                        IContent content;
                        if (!pollingEndpoint.ProcessAsPlainText)
                        {
                            content = ContentFactory.GetContent(ComponentContainer, newItem);
                        }
                        else
                        {
                            content = (IContent)ContentFactory.GetTextContent(ComponentContainer, newItem);
                        }

                        contentToProcess.Add(content);
                    }
                });

                // process new content
                if (contentToProcess != null && contentToProcess.Count > 0)
                {
                    ContentProcessors.ForEach(contentProcessor => contentProcessor.Process(contentToProcess));
                }
            });
        }