public async Task ProcessAsync(SystemQueueProcessorCommand command, IQuidjiboProgress progress, CancellationToken cancellationToken)
        {
            if (progress != null)
            {
                progress.Report(1, $"Starting the {Name} Task");
            }

            RabbitInboundQueueProvider queue = new RabbitInboundQueueProvider();

            queue.CqrsEventQueueReceived += OnCqrsEventQueueReceived;

            await queue.Start();

            while (!cancellationToken.IsCancellationRequested)
            {
                Thread.Sleep(500);
            }

            //await Task.Factory.StartNew(() =>
            //{
            //	// Keep alive
            //	while (_running)
            //	{
            //		Thread.Sleep(1000);
            //	}
            //}, cancellationToken, TaskCreationOptions.LongRunning, TaskScheduler.Default);

            if (progress != null)
            {
                progress.Report(100, $"Finishing the {Name} Task");
            }
        }
Esempio n. 2
0
        public async Task ProcessAsync(QueuesProcessorCommand command, IQuidjiboProgress progress, CancellationToken cancellationToken)
        {
            progress.Report(1, $"Starting the {Name} Task");

            RabbitInboundQueueProvider queue = new RabbitInboundQueueProvider();

            queue.CallQueueReceived              += OnCallQueueReceived;
            queue.MessageQueueReceived           += OnMessageQueueReceived;
            queue.DistributionListQueueReceived  += OnDistributionListQueueReceived;
            queue.NotificationQueueReceived      += OnNotificationQueueReceived;
            queue.ShiftNotificationQueueReceived += OnShiftNotificationQueueReceived;

            queue.Start();

            await Task.Factory.StartNew(() =>
            {
                // Keep alive
                while (_running)
                {
                    Thread.Sleep(1000);
                }
            }, cancellationToken, TaskCreationOptions.LongRunning, TaskScheduler.Default);

            progress.Report(100, $"Finishing the {Name} Task");
        }
        public async Task ProcessAsync(PaymentQueueProcessorCommand command, IQuidjiboProgress progress, CancellationToken cancellationToken)
        {
            if (progress != null)
            {
                progress.Report(1, $"Starting the {Name} Task");
            }

            RabbitInboundQueueProvider queue = new RabbitInboundQueueProvider();

            queue.PaymentEventQueueReceived += OnPaymentEventQueueReceived;

            await queue.Start();

            while (!cancellationToken.IsCancellationRequested)
            {
                Thread.Sleep(500);
            }

            if (progress != null)
            {
                progress.Report(100, $"Finishing the {Name} Task");
            }
        }