Пример #1
0
        public static void Start(int id, double coef)
        {
            var factory = new ConnectionFactory
            {
                HostName = "95.85.3.163",
                Password = "******",
                UserName = "******"
            };
            var properties = new BasicProperties {
                AppId = $"#{id}"
            };

            using (var connection = factory.CreateConnection())
                using (var channel = connection.CreateModel())
                {
                    channel.QueueDeclare("performance", false, false, false, null);

                    while (true)
                    {
                        var mould = PerformanceHelper.GetMould(coef);
                        var bytes = mould.ToBytes();
                        channel.BasicPublish("", "performance", properties, bytes);

                        Thread.Sleep(1000);
                    }
                }
        }