Beispiel #1
0
        private async Task <bool> createQueue(string exchangeName, string queueName)
        {
            RabbitMQHttpApiQueueResultDTO queueModel = Task.Run(async() =>
            {
                return(await RabbitMQHttpApiConsumer.GetQueueByNameAsync(queueName));
            }).Result;

            if (queueModel != null)
            {
                await RabbitMQHttpApiConsumer.DeleteQueueAsync(queueName);
            }

            bool IsBinded = false;

            bool IsCreated = await RabbitMQHttpApiConsumer.CreateQueueAsync(queueName);

            if (IsCreated)
            {
                IsBinded = await RabbitMQHttpApiConsumer.BindQueueAsync(exchangeName, queueName);
            }

            if (IsBinded)
            {
                AddOneTimeCleanupAction(async() => await RabbitMQHttpApiConsumer.DeleteQueueAsync(queueName));
            }

            return(IsBinded);
        }
Beispiel #2
0
        private void prepareRabbitQueues()
        {
            RabbitMQHttpApiConsumer.Setup(new RabbitMQHttpApiSettings(_configBuilder));


            if (!Int32.TryParse(_configBuilder.Config["RabbitMQMessageWait"], out waitForRabbitMQMessage))
            {
                waitForRabbitMQMessage = 20000;
            }

            List <Task <bool> > createQueueTasks = new List <Task <bool> >
            {
                createQueue("lykke.cashinout", "lykke.cashinout." + Constants.TestQueueName),
                createQueue("lykke.transfers", "lykke.transfers." + Constants.TestQueueName),
                createQueue("lykke.cashswap", "lykke.cashswap." + Constants.TestQueueName),
                createQueue("lykke.balanceupdate", "lykke.balanceupdate." + Constants.TestQueueName),
                createQueue("lykke.limitorders.clients", "lykke.limitorders.clients." + Constants.TestQueueName),
                createQueue("lykke.trades", "lykke.trades." + Constants.TestQueueName)
            };

            Task.WhenAll(createQueueTasks).Wait();
        }