public async Task PublishMessagesToLocalHostAsync(int messagesToSend, List <byte[]> payloads)
        {
            var queueName1 = "CookedRabbit.Benchmark.Scaling1";
            var queueName2 = "CookedRabbit.Benchmark.Scaling2";
            var queueName3 = "CookedRabbit.Benchmark.Scaling3";
            var queueName4 = "CookedRabbit.Benchmark.Scaling4";
            var queueName5 = "CookedRabbit.Benchmark.Scaling5";

            var exchangeName = string.Empty;

            var createSuccess1 = await _topologyService.QueueDeclareAsync(queueName1);

            var createSuccess2 = await _topologyService.QueueDeclareAsync(queueName2);

            var createSuccess3 = await _topologyService.QueueDeclareAsync(queueName3);

            var createSuccess4 = await _topologyService.QueueDeclareAsync(queueName4);

            var createSuccess5 = await _topologyService.QueueDeclareAsync(queueName5);

            var task1 = _deliveryService.PublishManyAsync(exchangeName, queueName1, payloads, false, null);
            var task2 = _deliveryService.PublishManyAsync(exchangeName, queueName2, payloads, false, null);
            var task3 = _deliveryService.PublishManyAsync(exchangeName, queueName3, payloads, false, null);
            var task4 = _deliveryService.PublishManyAsync(exchangeName, queueName4, payloads, false, null);
            var task5 = _deliveryService.PublishManyAsync(exchangeName, queueName5, payloads, false, null);

            await Task.WhenAll(new Task[] { task1, task2, task3, task4, task5 });
        }
Beispiel #2
0
        public async Task Benchmark_Delivery_PublishManyAsync(int messagesToSend, int messageSizes)
        {
            if (FirstRun)
            {
                await Setup(messagesToSend, messageSizes);
            }

            var success = await _deliveryService.PublishManyAsync(ExchangeName, QueueName, Payloads, false, null);

            await _maintenanceService.PurgeQueueAsync(QueueName);
        }
        public static async Task RabbitService_SendManyWithLimitAsync()
        {
            var count    = 0;
            var payloads = new List <byte[]>();

            while (count < SendLimit)
            {
                //await Task.Delay(rand.Next(0, 2)); // Throttle Option
                var message = $"{helloWorld} {count}";
                _accuracyCheck.TryAdd(message, false);
                payloads.Add(Encoding.UTF8.GetBytes(message));
                count++;
            }

            var task1 = _rabbitDeliveryService.PublishManyAsync(exchangeName, queueName, payloads); // Blocks transmission

            await Task.WhenAll(new Task[] { task1 });
        }
Beispiel #4
0
 public async Task Benchmark_Delivery_PublishManyAsync()
 {
     await _deliveryService.PublishManyAsync(ExchangeName, QueueName, Payloads, false, null);
 }