diff Messaging/Server/Listeners/RabbitQueueListener.cs @ 31:7d9de5746f18

Working version
author adminsh@apollo
date Thu, 22 Mar 2012 08:09:41 +0000
parents 4c0dea4760c5
children
line wrap: on
line diff
--- a/Messaging/Server/Listeners/RabbitQueueListener.cs	Wed Mar 21 22:26:48 2012 +0000
+++ b/Messaging/Server/Listeners/RabbitQueueListener.cs	Thu Mar 22 08:09:41 2012 +0000
@@ -6,7 +6,6 @@
 using RabbitMQ.Client;
 using RabbitMQ.Client.Events;
 using RabbitMQ.Client.MessagePatterns;
-using Server.Interfaces;
 
 namespace Server.Listeners
 {
@@ -37,11 +36,9 @@
                 {
                     using (var channel = connection.CreateModel())
                     {
-                        Log(string.Format("Creating a queue {0} and binding it to amq.direct", _queueName));
+                        Log("Opening listener");
                         string queueName = channel.QueueDeclare(_queueName, false, false, false, null);
-
                         channel.QueueBind(queueName, "amq.direct", queueName, null);
-                        Log("Done.");
 
                         using (_subscription = new Subscription(channel, queueName))
                         {
@@ -67,10 +64,10 @@
 
         public void Stop()
         {
-            Log("Closing listener...");
+            if (!IsListening) return;
             _subscription.Close();
             IsListening = false;
-            Log("Done.");
+            Log("Listener closed.");
         }
 
         private void Log(string message)