public void Start(string queueName) { var mqSender = new MqSender(_settings); var t = Task.Run(() => PutRandomMessages(mqSender, queueName, _ct.Token), _ct.Token); _tasks.Add(t); }
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); } }