public static void Publish(IBus bus) { foreach (var word in WordLoader.LoadWords()) { Thread.Sleep(10); bus.Publish(new WordMessage { Word = word }); Console.WriteLine("Published '{0}'", word); } }
public static void Publish(IBus bus) { using (var channel = bus.OpenPublishChannel()) { foreach (var word in WordLoader.LoadWords()) { var topic = word.Substring(0, 1); Thread.Sleep(10); channel.Publish(topic, new WordMessage { Word = word }); Console.WriteLine("Published '{0}'", word); } } }