Beispiel #1
0
        public async Task Initialize()
        {
            Log(ErrorCode.PersistentStreamPullingManager_02, "Init.");

            await this.queueBalancer.Initialize(this.adapterFactory.GetStreamQueueMapper());

            queueBalancer.SubscribeToQueueDistributionChangeEvents(this);

            List <QueueId> myQueues = queueBalancer.GetMyQueues().ToList();

            Log(ErrorCode.PersistentStreamPullingManager_03, String.Format("Initialize: I am now responsible for {0} queues: {1}.", myQueues.Count, PrintQueues(myQueues)));

            queuePrintTimer = this.RegisterTimer(AsyncTimerCallback, null, QUEUES_PRINT_PERIOD, QUEUES_PRINT_PERIOD);
            managerState    = RunState.Initialized;
        }
        public async Task Initialize(Immutable <IQueueAdapter> qAdapter)
        {
            if (qAdapter.Value == null)
            {
                throw new ArgumentNullException("qAdapter", "Init: queueAdapter should not be null");
            }

            Log(ErrorCode.PersistentStreamPullingManager_02, "Init.");

            // Remove cast once we cleanup
            queueAdapter = qAdapter.Value;
            await this.queueBalancer.Initialize(this.adapterFactory.GetStreamQueueMapper());

            queueBalancer.SubscribeToQueueDistributionChangeEvents(this);

            List <QueueId> myQueues = queueBalancer.GetMyQueues().ToList();

            Log(ErrorCode.PersistentStreamPullingManager_03, String.Format("Initialize: I am now responsible for {0} queues: {1}.", myQueues.Count, PrintQueues(myQueues)));

            queuePrintTimer = this.RegisterTimer(AsyncTimerCallback, null, QUEUES_PRINT_PERIOD, QUEUES_PRINT_PERIOD);
            managerState    = RunState.Initialized;
        }
Beispiel #3
0
        public Task Initialize(Immutable <IQueueAdapter> qAdapter)
        {
            if (qAdapter.Value == null)
            {
                throw new ArgumentNullException("qAdapter", "Init: queueAdapter should not be null");
            }

            logger.Info((int)ErrorCode.PersistentStreamPullingManager_02, "Init.");

            // Remove cast once we cleanup
            queueAdapter = qAdapter.Value;

            var meAsQueueBalanceListener = this.AsReference <IStreamQueueBalanceListener>();

            queueBalancer.SubscribeToQueueDistributionChangeEvents(meAsQueueBalanceListener);

            List <QueueId> myQueues = queueBalancer.GetMyQueues().ToList();

            logger.Info((int)ErrorCode.PersistentStreamPullingManager_03, PrintMyState(myQueues));

            return(AddNewQueues(myQueues, true));
        }
        public Task Initialize(Immutable <IQueueAdapter> qAdapter)
        {
            if (qAdapter.Value == null)
            {
                throw new ArgumentNullException("qAdapter", "Init: queueAdapter should not be null");
            }

            logger.Info((int)ErrorCode.PersistentStreamPullingManager_02, "Init.");

            // Remove cast once we cleanup
            queueAdapter = qAdapter.Value;

            var meAsQueueBalanceListener = this.AsReference <IStreamQueueBalanceListener>();

            queueBalancer.SubscribeToQueueDistributionChangeEvents(meAsQueueBalanceListener);

            List <QueueId> myQueues = queueBalancer.GetMyQueues().ToList();

            logger.Info((int)ErrorCode.PersistentStreamPullingManager_03, String.Format("I am now responsible for {0} queues: {1}.", myQueues.Count, PrintQueues(myQueues)));

            managerState = PersistentStreamProviderState.Initialized;
            return(TaskDone.Done);
        }