Example #1
0
        public async Task ConsumerPipelineStartAndStopTesting()
        {
            var consumerPipeline = rabbitService.CreateConsumerPipeline <WorkState>("ConsumerFromConfig", 100, false, BuildPipeline);

            for (int i = 0; i < 100; i++)
            {
                await consumerPipeline.StartAsync(true);

                await consumerPipeline.StopAsync();
            }
        }
Example #2
0
        // Processing Message Loop
        private async Task ProcessMessagesAsync(CancellationToken token = default)
        {
            try
            {
                _logger?.LogInformation($"Starting {nameof(TextMessageWorkerService)}...");

                _consumerPipeline = _rabbitService.CreateConsumerPipeline(_consumerName, BuildPipeline);
                _errorQueue       = _options.ErrorQueueName;

                await _consumerPipeline.StartAsync(false, token).ConfigureAwait(false);
            }
            catch { /* SWALLOW */ }
        }
Example #3
0
        // Processing Message Loop
        private async Task ProcessMessagesAsync()
        {
            try
            {
                _logger?.LogInformation($"Starting {nameof(TextMessageWorkerService)}...");

                _consumerPipeline = _rabbitService.CreateConsumerPipeline <TwilioWorkState>(_consumerName, BuildPipeline);
                _errorQueue       = _options.ErrorQueueName;

                await _consumerPipeline.StartAsync(false).ConfigureAwait(false);
            }
            catch { }
        }
Example #4
0
        public async Task StartAsync()
        {
            _targetCount = Program.GlobalCount;
            await Console.Out.WriteLineAsync("\r\nRunning example...\r\n").ConfigureAwait(false);

            _rabbitService = await SetupAsync().ConfigureAwait(false);

            _errorQueue = _rabbitService.Config.GetConsumerSettings("ConsumerFromConfig").ErrorQueueName;

            _consumerPipeline = _rabbitService.CreateConsumerPipeline("ConsumerFromConfig", Program.MaxDoP, Program.EnsureOrdered, BuildPipeline);
            Program.Stopwatch = Stopwatch.StartNew();
            await _consumerPipeline.StartAsync(Program.UseStreamPipeline).ConfigureAwait(false);

            if (Program.AwaitShutdown)
            {
                await Console.Out.WriteLineAsync("\r\nAwaiting full ConsumerPipeline finish...\r\n").ConfigureAwait(false);

                await _consumerPipeline.AwaitCompletionAsync().ConfigureAwait(false);
            }
            Program.Stopwatch.Stop();
            await Console.Out.WriteLineAsync("\r\nExample finished...").ConfigureAwait(false);
        }