Ejemplo n.º 1
0
 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);
     }
 }
Ejemplo n.º 2
0
        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);
                }
            }
        }