예제 #1
0
        private void ProcessFeed(DataFeed dataFeed)
        {
            VkGroup        group     = this.groupRepository.GetGroupById(dataFeed.VkGroupId);
            IFeedProcessor processor = this.processorFactory.Create(dataFeed.Type);

            using (var transaction = this.transactionProvider.CreateTransaction().Begin())
            {
                this.log.InfoFormat("Processing data feed with VkGroupId={0} ({1}) is started", dataFeed.VkGroupId, dataFeed.Type);

                try
                {
                    processor.Process(dataFeed, group);
                    transaction.Commit();
                    this.log.InfoFormat("Processing data feed with VkGroupId={0} ({1}) is finished", dataFeed.VkGroupId, dataFeed.Type);
                }
                catch (Exception exc)
                {
                    transaction.Rollback();
                    this.log.ErrorFormat("Data feed with VkGroupId={0} ({1}) is failed to be processed. Reason: {2}", dataFeed.VkGroupId, dataFeed.Type, exc.ToString());
                    throw;
                }
                finally
                {
                    dataFeed.MarkAsCompleted();
                    this.log.InfoFormat("Data feed with Id={0} ({1}) is deleted", dataFeed.VkGroupId, dataFeed.Type);
                }
            }
        }
예제 #2
0
        public void Setup()
        {
            _feedProcessor = A.Fake<IFeedProcessor>();
            _command = A.Fake<ICommand<PersistFeedRequest>>();
            _pathResolver = A.Fake<IPathResolver>();
            _fileReader = A.Fake<IFileReader>();

            _subject = new RacesFeedIngester(new[] { _feedProcessor }, _command, _pathResolver, _fileReader);
        }
예제 #3
0
 private void InvalidateProcessors()
 {
     _locationProcessor   = new LocationProcessor(_deviceInfo, _user, _httpRequestProcessor, _logger);
     _collectionProcessor = new CollectionProcessor(_deviceInfo, _user, _httpRequestProcessor, _logger);
     _mediaProcessor      = new MediaProcessor(_deviceInfo, _user, _httpRequestProcessor, _logger);
     _userProcessor       = new UserProcessor(_deviceInfo, _user, _httpRequestProcessor, _logger);
     _storyProcessor      = new StoryProcessor(_deviceInfo, _user, _httpRequestProcessor, _logger);
     _commentProcessor    = new CommentProcessor(_deviceInfo, _user, _httpRequestProcessor, _logger);
     _profileProcessor    = new UserProfileProcessor(_deviceInfo, _user, _httpRequestProcessor, _logger);
     _messagingProcessor  = new MessagingProcessor(_deviceInfo, _user, _httpRequestProcessor, _logger);
     _feedProcessor       = new FeedProcessor(_deviceInfo, _user, _httpRequestProcessor, _logger);
 }
예제 #4
0
        private void ProcessTerminator(DataFeed dataFeed)
        {
            VkGroupProcessingHistoryItem item = new VkGroupProcessingHistoryItem
            {
                FeedType          = dataFeed.Type,
                VkGroupId         = dataFeed.VkGroupId,
                FetchingDate      = dataFeed.SendingDate,
                FetchingServer    = dataFeed.FetchingServer,
                FetchingProcess   = dataFeed.FetchingProcess,
                ProcessingDate    = this.dateTimeHelper.GetDateTimeNow(),
                ProcessingServer  = this.webUtilities.GetServerName(),
                ProcessingProcess = this.webUtilities.GetApplicationPoolName()
            };

            using (var transaction = this.transactionProvider.CreateTransaction().Begin())
            {
                try
                {
                    int version = this.groupRepository.SaveGroupProcessingHistoryItem(item);
                    transaction.Commit();

                    IFeedProcessor processor = this.processorFactory.Create(dataFeed.Type);
                    processor.ProcessTerminator(dataFeed.VkGroupId, version);
                }
                catch (Exception exc)
                {
                    transaction.Rollback();
                    this.log.ErrorFormat("Terminator feed with VkGroupId={0} ({1}) is failed to be processed. Reason: {2}", dataFeed.VkGroupId, dataFeed.Type, exc.ToString());
                    throw;
                }
                finally
                {
                    dataFeed.MarkAsCompleted();
                }
            }
        }
예제 #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FcsContractEventFeedReaderTimerFunction" /> class.
 /// </summary>
 /// <param name="feedProcessor">The feed processor.</param>
 public FcsContractEventFeedReaderTimerFunction(IFeedProcessor feedProcessor)
 {
     _feedProcessor = feedProcessor;
 }
        private const int PollDefaultTime = 1*60*60*1000; // 1 Hour default

        public FeedSchedular(ILogger logger, IFeedProcessor feedProcessor)
        {
            _logger = logger;
            _feedProcessor = feedProcessor;
        }
예제 #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FcsAtomFeedProcessorFunction" /> class.
 /// </summary>
 /// <param name="feedProcessor">The feed processor.</param>
 public FcsAtomFeedProcessorFunction(IFeedProcessor feedProcessor)
 {
     _feedProcessor = feedProcessor;
 }
        private const int PollDefaultTime = 1 * 60 * 60 * 1000; // 1 Hour default

        public FeedSchedular(ILogger logger, IFeedProcessor feedProcessor)
        {
            _logger        = logger;
            _feedProcessor = feedProcessor;
        }