/// <summary>
        /// 批量生产消息,发消息队列
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnWrite(object sender, LogMessageEventArgs e)
        {
            IDataBuffer <object> data = e.Message as IDataBuffer <object>;

            if (data != null)
            {
                var        list   = data.GetList().Cast <DataObj>().ToList();
                ServerInfo server = RabbitMQConfig.ServerInfoList[3];
                EasyNetQHelper.SendAsync(server.Code, list);
            }
        }
Ejemplo n.º 2
0
        public void TestSendT()
        {
            ServerInfo server = RabbitMQConfig.ServerInfoList[0];

            for (int i = 0; i < 1000; i++)
            {
                var data = new DataObj {
                    Index = i, Des = "测试" + i, CreateTime = DateTime.Now
                };
                EasyNetQHelper.SendAsync(server.Code, data);
            }
        }
Ejemplo n.º 3
0
        public void TestSendList()
        {
            ServerInfo      server = RabbitMQConfig.ServerInfoList[1];
            IList <DataObj> list   = new List <DataObj>();

            for (int i = 0; i < 10; i++)
            {
                var data = new DataObj {
                    Index = i, Des = "测试" + i, CreateTime = DateTime.Now
                };
                list.Add(data);
            }
            //DataObjCollection col = list;
            EasyNetQHelper.SendAsync(server.Code, list);

            Thread.Sleep(1000 * 60 * 10);
        }