Exemple #1
0
        [TestMethod] public void CreateExchangeAndQueue()
        {
            string prefix   = "РИБ";
            string mainNode = "MAIN";

            string[]         rayNodes = new string[] { "N001", "N002" };
            IMessageProducer producer = new MessageProducer(Settings);

            for (int i = 0; i < rayNodes.Length; i++)
            {
                producer.CreateQueue($"{prefix}.{mainNode}.{rayNodes[i]}");
                producer.CreateQueue($"{prefix}.{rayNodes[i]}.{mainNode}");
            }
        }
        [TestMethod] public void TestCreateQueue()
        {
            List <string> queues = new List <string>()
            {
                "accord.dajet.goods",
                "accord.dajet.prices",
                "accord.dajet.regions",
                "accord.dajet.counterparties"
            };

            using (IMessageProducer producer = new MessageProducer(Settings))
            {
                foreach (string queueName in queues)
                {
                    Settings.Value.QueueName    = queueName;
                    Settings.Value.ExchangeName = queueName;

                    if (producer.QueueExists())
                    {
                        Console.WriteLine("Queue " + queueName + " exists.");
                    }
                    else
                    {
                        Console.WriteLine("Queue " + queueName + " is not found.");
                        producer.CreateQueue();
                        Console.WriteLine("Queue " + queueName + " created successfully.");

                        if (producer.QueueExists())
                        {
                            Console.WriteLine("Queue " + queueName + " exists.");
                        }
                        else
                        {
                            Console.WriteLine("Queue " + queueName + " does not exist.");
                        }
                    }
                }
            }
        }