コード例 #1
0
        public void Start(string queueName)
        {
            var mqSender = new MqSender(_settings);
            var t        = Task.Run(() => PutRandomMessages(mqSender, queueName, _ct.Token), _ct.Token);

            _tasks.Add(t);
        }
コード例 #2
0
        private void PutRandomMessages(MqSender mqSender, string queueName, CancellationToken token)
        {
            var generator = new MessageGenerator();

            while (!token.IsCancellationRequested)
            {
                mqSender.PutMessage(queueName, generator.RandomString(1024), Guid.NewGuid().ToString("N").ToUpper());

                Thread.Sleep(100);
            }
        }