public GameRepository(IAzureBlobContainer <Game> gameContainer, IAzureBlobContainer <GameQueue> gameQueueContainer, IAzureBlobContainer <UserProfile> userContainer, IAzureQueue <InviteMessage> inviteQueue)
        {
            if (gameContainer == null)
            {
                throw new ArgumentNullException("gameContainer");
            }

            if (gameQueueContainer == null)
            {
                throw new ArgumentNullException("gameQueueContainer");
            }

            if (userContainer == null)
            {
                throw new ArgumentNullException("userContainer");
            }

            if (inviteQueue == null)
            {
                throw new ArgumentNullException("inviteQueue");
            }

            this.gameContainer      = gameContainer;
            this.gameQueueContainer = gameQueueContainer;
            this.userContainer      = userContainer;
            this.inviteQueue        = inviteQueue;
        }
        public GameRepository(IAzureBlobContainer<Game> gameContainer, IAzureBlobContainer<GameQueue> gameQueueContainer, IAzureBlobContainer<UserProfile> userContainer, IAzureQueue<InviteMessage> inviteQueue)
        {
            if (gameContainer == null)
            {
                throw new ArgumentNullException("gameContainer");
            }

            if (gameQueueContainer == null)
            {
                throw new ArgumentNullException("gameQueueContainer");
            }

            if (userContainer == null)
            {
                throw new ArgumentNullException("userContainer");
            }

            if (inviteQueue == null)
            {
                throw new ArgumentNullException("inviteQueue");
            }

            this.gameContainer = gameContainer;
            this.gameQueueContainer = gameQueueContainer;
            this.userContainer = userContainer;
            this.inviteQueue = inviteQueue;
        }
示例#3
0
 public static QueueBatchConfiguration BuildConfig(IAzureQueue <T> queue, int batchSize)
 {
     return(new QueueBatchConfiguration()
     {
         Queue = queue, BatchSize = batchSize
     });
 }
示例#4
0
 protected BatchMultipleQueueHandler(IAzureQueue <T> queue, int batchSize)
 {
     this.queuesConfiguration = new List <QueueBatchConfiguration>();
     this.queuesConfiguration.Add(QueueBatchConfiguration.BuildConfig(queue, batchSize));
     this.interval           = TimeSpan.FromMilliseconds(200);
     this.maxBatchesPerCycle = 10;
 }
 public UrlTrackerDataSource(IRepository<UrlVisited> UrlRepository, 
     IAzureQueue<UrlRedirectMessage> TrackerQueue,
     IRepository<UrlSummary> UrlRefRepository)
 {
     _UrlRepository = UrlRepository;
     _UrlRefRepository = UrlRefRepository;
     _TrackerQueue = TrackerQueue;
     _TrackerQueue.EnsureExist();
 }
        public GameActionStatisticsQueue(IAzureQueue<GameActionStatisticsMessage> gameActionStatisticsQueue)
        {
            if (gameActionStatisticsQueue == null)
            {
                throw new ArgumentNullException("gameActionStatisticsQueue");
            }

            this.gameActionStatisticGameQueue = gameActionStatisticsQueue;
        }
        public GameActionNotificationQueue(IAzureQueue<GameActionNotificationMessage> gameActionNotificationQueue)
        {
            if (gameActionNotificationQueue == null)
            {
                throw new ArgumentNullException("gameActionNotificationQueue");
            }

            this.gameActionNotificationGameQueue = gameActionNotificationQueue;
        }
        public GameActionStatisticsQueue(IAzureQueue <GameActionStatisticsMessage> gameActionStatisticsQueue)
        {
            if (gameActionStatisticsQueue == null)
            {
                throw new ArgumentNullException("gameActionStatisticsQueue");
            }

            this.gameActionStatisticGameQueue = gameActionStatisticsQueue;
        }
        public static BatchProcessingQueueHandler <T> For(IAzureQueue <T> queue)
        {
            if (queue == null)
            {
                throw new ArgumentNullException("queue");
            }

            return(new BatchProcessingQueueHandler <T>(queue));
        }
        public GameActionNotificationQueue(IAzureQueue <GameActionNotificationMessage> gameActionNotificationQueue)
        {
            if (gameActionNotificationQueue == null)
            {
                throw new ArgumentNullException("gameActionNotificationQueue");
            }

            this.gameActionNotificationGameQueue = gameActionNotificationQueue;
        }
示例#11
0
        public static CheckConditionWithAcceptCallback <TMessage> OfType <TMessage>(IAzureQueue <TMessage> queue) where TMessage : AzureQueueMessage
        {
            var messageQueueCondition = new MessageOfTypeQueueCondition <TMessage>(queue);

            return(new CheckConditionWithAcceptCallback <TMessage>
            {
                CheckFunc = messageQueueCondition.GetMessageFunc,
                ConfirmFunc = messageQueueCondition.DequeueFunc
            });
        }
示例#12
0
        public static BatchMultipleQueueHandler <T> For(IAzureQueue <T> queue, int batchSize)
        {
            if (queue == null)
            {
                throw new ArgumentNullException("queue");
            }

            batchSize = Math.Max(1, batchSize);

            return(new BatchMultipleQueueHandler <T>(queue, batchSize));
        }
示例#13
0
        public FeedController(IRepository<Feed> feedRepository, 
            IRepository<GroupFeed> groupFeedRepository, 
            IClaimsInfo claimsInfo,
            IAzureQueue azureQueue)
        {
            _feedRepository = feedRepository;
            _groupFeedRepository = groupFeedRepository;
            _azureQueue = azureQueue;

            _userId = claimsInfo.GetCurrentUserId();
        }
        public BatchProcessingQueueHandler <T> WithPosionMessageQueue(IAzureQueue <T> poisonQueue)
        {
            if (poisonQueue == null)
            {
                throw new ArgumentNullException("poisonQueue");
            }

            this.poisonMessageQueue = poisonQueue;

            return(this);
        }
示例#15
0
 public SurveyAnswerStore(
     ITenantStore tenantStore, 
     ISurveyAnswerContainerFactory surveyAnswerContainerFactory,
     IAzureQueue<SurveyAnswerStoredMessage> standardSurveyAnswerStoredQueue, 
     IAzureQueue<SurveyAnswerStoredMessage> premiumSurveyAnswerStoredQueue, 
     IAzureBlobContainer<List<string>> surveyAnswerIdsListContainer)
 {
     this.tenantStore = tenantStore;
     this.surveyAnswerContainerFactory = surveyAnswerContainerFactory;
     this.standardSurveyAnswerStoredQueue = standardSurveyAnswerStoredQueue;
     this.premiumSurveyAnswerStoredQueue = premiumSurveyAnswerStoredQueue;
     this.surveyAnswerIdsListContainer = surveyAnswerIdsListContainer;
 }
示例#16
0
        public BatchMultipleQueueHandler <T> AndFor(IAzureQueue <T> queue, int batchSize)
        {
            if (queue == null)
            {
                throw new ArgumentNullException("queue");
            }

            batchSize = Math.Max(1, batchSize);

            this.queuesConfiguration.Add(QueueBatchConfiguration.BuildConfig(queue, batchSize));

            return(this);
        }
 public SurveyAnswerStore(
     ITenantStore tenantStore,
     ISurveyAnswerContainerFactory surveyAnswerContainerFactory,
     IAzureQueue <SurveyAnswerStoredMessage> standardSurveyAnswerStoredQueue,
     IAzureQueue <SurveyAnswerStoredMessage> premiumSurveyAnswerStoredQueue,
     IAzureBlobContainer <List <string> > surveyAnswerIdsListContainer)
 {
     this.tenantStore = tenantStore;
     this.surveyAnswerContainerFactory    = surveyAnswerContainerFactory;
     this.standardSurveyAnswerStoredQueue = standardSurveyAnswerStoredQueue;
     this.premiumSurveyAnswerStoredQueue  = premiumSurveyAnswerStoredQueue;
     this.surveyAnswerIdsListContainer    = surveyAnswerIdsListContainer;
 }
        protected static void ProcessMessages(IAzureQueue<T> queue, IEnumerable<T> messages, Func<T, bool> action)
        {
            if (queue == null)
            {
                throw new ArgumentNullException("queue");
            }

            if (action == null)
            {
                throw new ArgumentNullException("action");
            }

            if (messages == null)
            {
                throw new ArgumentNullException("messages");
            }

            foreach (var message in messages)
            {
                var allowDelete = false;
                var corruptMessage = false;

                try
                {
                    allowDelete = action(message);
                }
                catch (Exception ex)
                {
                    TraceHelper.TraceError(ex.TraceInformation());
                    corruptMessage = true;
                }
                finally
                {
                    if (allowDelete || (corruptMessage && message.GetMessageReference().DequeueCount > 5))
                    {
                        try
                        {
                            queue.DeleteMessage(message);
                        }
                        catch (Exception ex)
                        {
                            TraceHelper.TraceError(
                                "Error deleting message type '{0}' id {1}: {2}", 
                                message.GetType().Name,
                                message.GetMessageReference().Id,
                                ex.TraceInformation());
                        }
                    }
                }
            }
        }
        private GameRepository CreateGameRepository()
        {
            CloudStorageAccount account = CloudStorageAccount.FromConfigurationSetting("DataConnectionString");

            this.gameContainer            = new AzureBlobContainer <Game>(account, ConfigurationConstants.GamesContainerName + "test" + this.suffix, true);
            this.gameQueueContainer       = new AzureBlobContainer <GameQueue>(account, ConfigurationConstants.GamesQueuesContainerName + "test" + this.suffix, true);
            this.skirmishGameMessageQueue = new AzureQueue <SkirmishGameQueueMessage>(account, ConfigurationConstants.SkirmishGameQueue + this.suffix);
            this.leaveGameMessageQueue    = new AzureQueue <LeaveGameMessage>(account, ConfigurationConstants.LeaveGameQueue + "test" + this.suffix);
            this.inviteMessageQueue       = new AzureQueue <InviteMessage>(account, ConfigurationConstants.InvitesQueue + "test" + this.suffix);

            this.gameContainer.EnsureExist(true);
            this.gameQueueContainer.EnsureExist(true);

            var repo = new GameRepository(this.gameContainer, this.gameQueueContainer, this.skirmishGameMessageQueue, this.leaveGameMessageQueue, this.userContainer, this.inviteMessageQueue);

            repo.Initialize();

            return(repo);
        }
        protected static void ProcessMessages(IAzureQueue <T> queue, IAzureQueue <T> deadQueue, IEnumerable <T> messages, Action <T> action)
        {
            if (queue == null)
            {
                throw new ArgumentNullException("queue");
            }

            if (action == null)
            {
                throw new ArgumentNullException("action");
            }

            if (messages == null)
            {
                throw new ArgumentNullException("messages");
            }

            foreach (var message in messages)
            {
                var success = false;

                try
                {
                    action(message);
                    success = true;
                }
                catch (Exception)
                {
                    success = false;
                }
                finally
                {
                    if (deadQueue != null && message.DequeueCount > 5)
                    {
                        deadQueue.AddMessage(message);
                    }
                    if (success || message.DequeueCount > 5)
                    {
                        queue.DeleteMessage(message);
                    }
                }
            }
        }
 public ProjectDetailsController(IProjectCommentsRepository commentsRepository, IProjectFileRepository fileRepository,
                                 IProjectFileInfoRepository fileInfoRepository, IProjectVoteRepository voteRepository,
                                 IProjectRepository projectRepository, IProjectParticipantsRepository participantsRepository,
                                 IProjectResultRepository resultRepository, IProjectResultVoteRepository resultVoteRepository,
                                 IProjectFollowRepository projectFollowRepository, IMailSentRepository mailSentRepository,
                                 IAzureQueue <string> emailsQueue)
 {
     _commentsRepository      = commentsRepository;
     _fileRepository          = fileRepository;
     _fileInfoRepository      = fileInfoRepository;
     _voteRepository          = voteRepository;
     _projectRepository       = projectRepository;
     _participantsRepository  = participantsRepository;
     _resultRepository        = resultRepository;
     _resultVoteRepository    = resultVoteRepository;
     _projectFollowRepository = projectFollowRepository;
     _mailSentRepository      = mailSentRepository;
     _emailsQueue             = emailsQueue;
 }
示例#22
0
 public ProjectController(IProjectRepository projectRepository, IProjectCommentsRepository commentsRepository,
                          IProjectFileRepository fileRepository, IProjectFileInfoRepository fileInfoRepository,
                          IProjectParticipantsRepository participantsRepository, IProjectCategoriesRepository categoriesRepository,
                          IProjectResultRepository resultRepository, IProjectFollowRepository projectFollowRepository,
                          IProjectWinnersRepository winnersRepository, IUserRolesRepository userRolesRepository,
                          IProjectWinnersService winnersService, IAzureQueue <string> emailsQueue)
 {
     _projectRepository       = projectRepository;
     _commentsRepository      = commentsRepository;
     _fileRepository          = fileRepository;
     _fileInfoRepository      = fileInfoRepository;
     _participantsRepository  = participantsRepository;
     _categoriesRepository    = categoriesRepository;
     _resultRepository        = resultRepository;
     _projectFollowRepository = projectFollowRepository;
     _winnersRepository       = winnersRepository;
     _userRolesRepository     = userRolesRepository;
     _winnersService          = winnersService;
     _emailsQueue             = emailsQueue;
 }
示例#23
0
        protected static async Task ProcessMessagesAsync(IAzureQueue <T> queue, IEnumerable <T> messages, Func <T, bool> action)
        {
            if (queue == null)
            {
                throw new ArgumentNullException(nameof(queue));
            }

            if (action == null)
            {
                throw new ArgumentNullException(nameof(action));
            }

            if (messages == null)
            {
                throw new ArgumentNullException(nameof(messages));
            }

            foreach (var message in messages)
            {
                var allowDelete    = false;
                var corruptMessage = false;

                try
                {
                    allowDelete = action(message);
                }
                catch (Exception ex)
                {
                    TraceHelper.TraceWarning(ex.TraceInformation());
                    allowDelete    = false;
                    corruptMessage = true;
                }
                finally
                {
                    if (allowDelete || (corruptMessage && message.GetMessageReference().DequeueCount > 5))
                    {
                        await queue.DeleteMessageAsync(message).ConfigureAwait(false);
                    }
                }
            }
        }
        private GameRepository CreateGameRepository()
        {
            CloudStorageAccount account = CloudStorageAccount.FromConfigurationSetting("DataConnectionString");
            this.gameContainer = new AzureBlobContainer<Game>(account, ConfigurationConstants.GamesContainerName + "test" + this.suffix, true);
            this.gameQueueContainer = new AzureBlobContainer<GameQueue>(account, ConfigurationConstants.GamesQueuesContainerName + "test" + this.suffix, true);
            this.skirmishGameMessageQueue = new AzureQueue<SkirmishGameQueueMessage>(account, ConfigurationConstants.SkirmishGameQueue + this.suffix);
            this.leaveGameMessageQueue = new AzureQueue<LeaveGameMessage>(account, ConfigurationConstants.LeaveGameQueue + "test" + this.suffix);
            this.inviteMessageQueue = new AzureQueue<InviteMessage>(account, ConfigurationConstants.InvitesQueue + "test" + this.suffix);

            this.gameContainer.EnsureExist(true);
            this.gameQueueContainer.EnsureExist(true);

            var repo = new GameRepository(this.gameContainer, this.gameQueueContainer, this.skirmishGameMessageQueue, this.leaveGameMessageQueue, this.userContainer, this.inviteMessageQueue);
            repo.Initialize();

            return repo;
        }
示例#25
0
 public MessageOfTypeQueueCondition(IAzureQueue <TMessage> queue)
 {
     this.queue = queue;
 }
示例#26
0
 public BatchProcessingQueueHandlerStub(IAzureQueue <MessageStub> queue)
     : base(queue, 32)
 {
 }
示例#27
0
 public DeleteMessageTests()
     : base(DirectoryType.Queue)
 {
     _queue = new StandaloneAzureQueue(BasePath);
 }
示例#28
0
 public SurveyTransferStore(IAzureQueue <SurveyTransferMessage> surveyTransferQueue)
 {
     this.surveyTransferQueue = surveyTransferQueue;
 }
 public SurveyTransferStore(IAzureQueue<SurveyTransferMessage> surveyTransferQueue)
 {
     this.surveyTransferQueue = surveyTransferQueue;
 }
示例#30
0
 public static QueueHandler <T> For <T>(IAzureQueue <T> queue) where T : AzureQueueMessage
 {
     return(QueueHandler <T> .For(queue));
 }
示例#31
0
 public QueueHandlerStub(IAzureQueue <MessageStub> queue)
     : base(queue)
 {
 }
 public static BatchProcessingQueueHandler <T> For <T>(IAzureQueue <T> queue) where T : AzureQueueMessage
 {
     return(BatchProcessingQueueHandler <T> .For(queue));
 }
 public static BatchMultipleQueueHandler <T> For <T>(IAzureQueue <T> queue, int batchSize) where T : AzureQueueMessage
 {
     return(BatchMultipleQueueHandler <T> .For(queue, batchSize));
 }
示例#34
0
 public GetMessageTests()
     : base(DirectoryType.Queue)
 {
     _queue = new StandaloneAzureQueue(BasePath);
 }
 protected BatchProcessingQueueHandler(IAzureQueue <T> queue)
 {
     this.queue    = queue;
     this.interval = TimeSpan.FromMilliseconds(200);
 }