SendMessage() 공개 메소드

public SendMessage ( string message ) : void
message string
리턴 void
 public void Publish10Messages()
 {
     using (var publisher = new TopicPublisher(session, "Excel.Test.Topic"))
     {
         for (int i = 0; i < 10; i++)
         {
             publisher.SendMessage(DateTime.Now.ToLongTimeString());
             Thread.Sleep(1000);
         }
     }
 }
        public void CanPublishAndSubscribe()
        {
            var messageToSend = DateTime.Now.ToLongTimeString();
            var recievedMessage = "";
            var waitForEvent = new EventWaitHandle(false,EventResetMode.AutoReset);
            using (var subscriber = new TopicSubscriber(session, "Excel.Test.Topic"))
            {
                subscriber.OnMessageRecieved += (sender, m) =>
                                                    {
                                                        waitForEvent.Set();
                                                        recievedMessage = m.Message;
                                                    };
                subscriber.Start("topic consumer");
                using (var publisher = new TopicPublisher(session, "Excel.Test.Topic"))
                {
                    publisher.SendMessage(messageToSend);
                }
                waitForEvent.WaitOne();
            }

            Assert.AreEqual(messageToSend, recievedMessage);
        }