changeset 29:9919ee227c93

msmq added
author adminsh@apollo
date Wed, 21 Mar 2012 22:09:18 +0000
parents 4c0dea4760c5
children 8d574f2d4174
files .hgignore Messaging/Client/Client.csproj Messaging/Client/MainWindow.xaml Messaging/Client/MainWindow.xaml.cs Messaging/Common/Messages/ClientMessages.cs Messaging/Common/Messages/LogMessages.cs Messaging/Common/Settings.cs Messaging/Server/EndPoints/BaseEndPoint.cs Messaging/Server/EndPoints/MessageEndPoint.cs Messaging/Server/EndPoints/RabbitEndPoint.cs Messaging/Server/EndPoints/RabbitProtoEndPoint.cs Messaging/Server/EndPoints/SocketEndPoint.cs Messaging/Server/Listeners/MsmqListener.cs Messaging/Server/Server.csproj Messaging/Server/UI/MainWindow.xaml Messaging/Server/UI/MainWindowViewModel.cs
diffstat 16 files changed, 320 insertions(+), 276 deletions(-) [+]
line wrap: on
line diff
--- a/.hgignore	Wed Mar 21 20:29:04 2012 +0000
+++ b/.hgignore	Wed Mar 21 22:09:18 2012 +0000
@@ -5,3 +5,4 @@
 *.csproj.user
 */obj/*
 */_ReSharper*
+Stocks/packages/*
--- a/Messaging/Client/Client.csproj	Wed Mar 21 20:29:04 2012 +0000
+++ b/Messaging/Client/Client.csproj	Wed Mar 21 22:09:18 2012 +0000
@@ -45,6 +45,7 @@
       <HintPath>..\Libs\RabbitMq.2.6.1.0\RabbitMQ.Client.dll</HintPath>
     </Reference>
     <Reference Include="System" />
+    <Reference Include="System.Messaging" />
     <Reference Include="System.Xml" />
     <Reference Include="System.Core" />
     <Reference Include="System.Xaml">
--- a/Messaging/Client/MainWindow.xaml	Wed Mar 21 20:29:04 2012 +0000
+++ b/Messaging/Client/MainWindow.xaml	Wed Mar 21 22:09:18 2012 +0000
@@ -6,6 +6,7 @@
         Height="350">
     <Grid>
         <StackPanel>
+            <Button Name="btnMsmq" Content="Msmq" Click="btnMsmq_Click" />
             <Button Name="btnSockets" Content="Sockets" />
             <Button Name="btnRabbit"
                     Click="BtnRabbitClick"
--- a/Messaging/Client/MainWindow.xaml.cs	Wed Mar 21 20:29:04 2012 +0000
+++ b/Messaging/Client/MainWindow.xaml.cs	Wed Mar 21 22:09:18 2012 +0000
@@ -1,6 +1,8 @@
 using System;
 using System.Collections.Generic;
+using System.Messaging;
 using System.Text;
+using System.Threading.Tasks;
 using System.Windows;
 using System.Windows.Controls;
 using System.Windows.Data;
@@ -20,6 +22,8 @@
     /// </summary>
     public partial class MainWindow : Window
     {
+        public const int MessageCount = 10000;
+
         public MainWindow()
         {
             InitializeComponent();
@@ -27,18 +31,51 @@
 
         private void BtnRabbitClick(object sender, RoutedEventArgs e)
         {
-            Task
-            var cf = new ConnectionFactory {Address = "localhost:" + Settings.RabbitPortNumber};
+            Task.Factory.StartNew(() =>
+            {
+                var cf = new ConnectionFactory {Address = "localhost:" + Settings.RabbitPortNumber};
 
-            using (var conn = cf.CreateConnection())
-            using (var channel = conn.CreateModel())
+                using (var conn = cf.CreateConnection())
+                using (var channel = conn.CreateModel())
+                {
+                    for (var i = 0; i < MessageCount; i++)
+                    {
+                        channel.BasicPublish("amq.direct", Settings.RabbitQueueName, null,
+                                             Encoding.UTF8.GetBytes("hello from the client!"));
+                    }
+                }
+            });
+        }
+
+        private void btnMsmq_Click(object sender, RoutedEventArgs e)
+        {
+            Task.Factory.StartNew(() =>
             {
-                for (var i = 0; i < 10000; i++)
+                var msMq 
+                    = !MessageQueue.Exists(Settings.MsmqQueueName) 
+                    ? MessageQueue.Create(Settings.MsmqQueueName) 
+                    : new MessageQueue(Settings.MsmqQueueName);
+
+                try
                 {
-                    channel.BasicPublish("amq.direct", Settings.QueueName, null,
-                                         Encoding.UTF8.GetBytes("hello from the client!"));
+                    for (var i = 0; i < MessageCount; i++)
+                    {
+                        msMq.Send("Sending data to MSMQ at " + DateTime.Now.ToString());
+                    }
+                }
+                catch (MessageQueueException ee)
+                {
+                    Console.Write(ee.ToString());
                 }
-            }
+                catch (Exception eee)
+                {
+                    Console.Write(eee.ToString());
+                }
+                finally
+                {
+                    msMq.Close();
+                }
+            });
         }
     }
 }
\ No newline at end of file
--- a/Messaging/Common/Messages/ClientMessages.cs	Wed Mar 21 20:29:04 2012 +0000
+++ b/Messaging/Common/Messages/ClientMessages.cs	Wed Mar 21 22:09:18 2012 +0000
@@ -2,15 +2,8 @@
 
 namespace Common.Messages
 {
-    public class SocketClientMessage : MessageBase
-    {
-    }
-
-    public class RabbitClientMessage : MessageBase
-    {
-    }
-
-    public class RabbitProtoClientMessage : MessageBase
-    {
-    }
+    public class MsmqClientMessage : MessageBase {}
+    public class SocketClientMessage : MessageBase {}
+    public class RabbitClientMessage : MessageBase {}
+    public class RabbitProtoClientMessage : MessageBase {}
 }
--- a/Messaging/Common/Messages/LogMessages.cs	Wed Mar 21 20:29:04 2012 +0000
+++ b/Messaging/Common/Messages/LogMessages.cs	Wed Mar 21 22:09:18 2012 +0000
@@ -7,15 +7,8 @@
         public string Body { get; set; }
     }
 
-    public class SocketLogMessage : LogMessage
-    {
-    }
-
-    public class RabbitLogMessage : LogMessage
-    {
-    }
-
-    public class RabbitProtoLogMessage : LogMessage
-    {
-    }
+    public class MsmqLogMessage : LogMessage {}
+    public class SocketLogMessage : LogMessage {}
+    public class RabbitLogMessage : LogMessage {}
+    public class RabbitProtoLogMessage : LogMessage {}
 }
--- a/Messaging/Common/Settings.cs	Wed Mar 21 20:29:04 2012 +0000
+++ b/Messaging/Common/Settings.cs	Wed Mar 21 22:09:18 2012 +0000
@@ -5,7 +5,8 @@
         public const int SocketsPortNumber = 5671;
         public const int RabbitPortNumber = 5672;
         public const int RabbitProtoPortNumber = 5673;
-        public const string QueueName = "Queue#1";
+        public const string MsmqQueueName = @".\private$\Queue#1";
+        public const string RabbitQueueName = "Queue#2";
         //public const string Uri = @"amqp://user:pass@localhost:5672/vhost\";
     }
 }
--- a/Messaging/Server/EndPoints/BaseEndPoint.cs	Wed Mar 21 20:29:04 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,168 +0,0 @@
-using System;
-using System.Threading.Tasks;
-using Common.Messages;
-using GalaSoft.MvvmLight;
-using GalaSoft.MvvmLight.Messaging;
-using Server.Interfaces;
-
-namespace Server.EndPoints
-{
-    public abstract class BaseEndPoint : ObservableObject
-    {
-        #region Fields
-
-        private readonly IListener _listener;
-
-        #endregion
-
-        #region Constructor
-
-        protected BaseEndPoint(IListener listener)
-        {
-            _listener = listener;
-        }
-
-        #endregion
-
-        public virtual void Init()
-        {
-
-        }
-
-        protected void LogMessageReceived(LogMessage m)
-        {
-            this.DisplayLog = DisplayLog + Environment.NewLine + m.Body;
-        }
-
-        protected void ClientMessageReceived(MessageBase m)
-        {
-            this.DisplayCount++;
-        }
-
-        #region Properties
-
-        #region IsListening
-
-        public const string IsListeningPropertyName = "IsListening";
-        private bool _isListening;
-        public bool IsListening
-        {
-            get { return _isListening; }
-            set
-            {
-                if (_isListening == value) return;
-                _isListening = value;
-                RaisePropertyChanged(() => IsListening);
-                ToggleListener();
-            }
-        }
-
-        #endregion
-
-        #region DisplayText
-
-        public const string DisplayTextPropertyName = "DisplayText";
-        private string _displayText;
-        public string DisplayText
-        {
-            get { return _displayText; }
-            set
-            {
-                if (_displayText == value) return;
-                _displayText = value;
-                RaisePropertyChanged(() => DisplayText);
-            }
-        }
-
-        #endregion
-
-        #region DisplayCount
-
-        public const string DisplayCountPropertyName = "DisplayCount";
-        private int _displayCount;
-        public int DisplayCount
-        {
-            get { return _displayCount; }
-            set
-            {
-                if (_displayCount == value) return;
-                _displayCount = value;
-                RaisePropertyChanged(() => DisplayCount);
-            }
-        }
-        #endregion
-
-        #region DisplayLog
-
-        public const string DisplayLogPropertyName = "DisplayLog";
-        private string _displayLog = string.Empty;
-        public string DisplayLog
-        {
-            get { return _displayLog; }
-            set
-            {
-                if (_displayLog == value) return;
-                _displayLog = value;
-                RaisePropertyChanged(() => DisplayLog);
-                IsLogChanged = true;
-            }
-        }
-
-        #endregion
-
-        #region IsLogChanged
-
-        public const string IsLogChangedPropertyName = "IsLogChanged";
-        private bool _isLogChanged;
-        public bool IsLogChanged
-        {
-            get { return _isLogChanged; }
-            set
-            {
-                if (_isLogChanged == value) return;
-                _isLogChanged = value;
-                RaisePropertyChanged(() => IsLogChanged);
-            }
-        }
-
-        #endregion
-
-        #region ToolTip
-
-        public const string ToolTipPropertyName = "ToolTip";
-        private string _toolTip = string.Empty;
-        public string ToolTip
-        {
-            get { return _toolTip; }
-            set
-            {
-                if (_toolTip == value) return;
-                _toolTip = value;
-                RaisePropertyChanged(() => ToolTip);
-            }
-        }
-
-        #endregion
-
-        #endregion
-
-        #region Commands
-
-
-        private void ToggleListener()
-        {
-            if (null == _listener) return;
-
-            if (_listener.IsListening)
-            {
-                Task.Factory.StartNew(_listener.Stop);
-            } 
-            else
-            {
-                Task.Factory.StartNew(_listener.Start);
-            }
-        }
-
-        #endregion
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Messaging/Server/EndPoints/MessageEndPoint.cs	Wed Mar 21 22:09:18 2012 +0000
@@ -0,0 +1,173 @@
+using System;
+using System.Threading.Tasks;
+using Common.Messages;
+using GalaSoft.MvvmLight;
+using GalaSoft.MvvmLight.Messaging;
+using Server.Interfaces;
+
+namespace Server.EndPoints
+{
+    public class MessageEndPoint<T, TV> : ObservableObject
+        where T : MessageBase
+        where TV : LogMessage
+        
+    {
+        #region Fields
+
+        private readonly IListener _listener;
+
+        #endregion
+
+        #region Constructor
+
+        public MessageEndPoint(IListener listener)
+        {
+            _listener = listener;
+            Init();
+        }
+
+        #endregion
+
+        public void Init()
+        {
+            Messenger.Default.Register<T>(this, ClientMessageReceived);
+            Messenger.Default.Register<TV>(this, LogMessageReceived);
+        }
+
+        protected void LogMessageReceived(TV message)
+        {
+            this.DisplayLog = DisplayLog + Environment.NewLine + message.Body;
+        }
+
+        protected void ClientMessageReceived(T message)
+        {
+            this.DisplayCount++;
+        }
+
+        #region Properties
+
+        #region IsListening
+
+        public const string IsListeningPropertyName = "IsListening";
+        private bool _isListening;
+        public bool IsListening
+        {
+            get { return _isListening; }
+            set
+            {
+                if (_isListening == value) return;
+                _isListening = value;
+                RaisePropertyChanged(() => IsListening);
+                ToggleListener();
+            }
+        }
+
+        #endregion
+
+        #region DisplayText
+
+        public const string DisplayTextPropertyName = "DisplayText";
+        private string _displayText;
+        public string DisplayText
+        {
+            get { return _displayText; }
+            set
+            {
+                if (_displayText == value) return;
+                _displayText = value;
+                RaisePropertyChanged(() => DisplayText);
+            }
+        }
+
+        #endregion
+
+        #region DisplayCount
+
+        public const string DisplayCountPropertyName = "DisplayCount";
+        private volatile int _displayCount;
+        public int DisplayCount
+        {
+            get { return _displayCount; }
+            set
+            {
+                if (_displayCount == value) return;
+                _displayCount = value;
+                RaisePropertyChanged(() => DisplayCount);
+            }
+        }
+        #endregion
+
+        #region DisplayLog
+
+        public const string DisplayLogPropertyName = "DisplayLog";
+        private string _displayLog = string.Empty;
+        public string DisplayLog
+        {
+            get { return _displayLog; }
+            set
+            {
+                if (_displayLog == value) return;
+                _displayLog = value;
+                RaisePropertyChanged(() => DisplayLog);
+                IsLogChanged = true;
+            }
+        }
+
+        #endregion
+
+        #region IsLogChanged
+
+        public const string IsLogChangedPropertyName = "IsLogChanged";
+        private bool _isLogChanged;
+        public bool IsLogChanged
+        {
+            get { return _isLogChanged; }
+            set
+            {
+                if (_isLogChanged == value) return;
+                _isLogChanged = value;
+                RaisePropertyChanged(() => IsLogChanged);
+            }
+        }
+
+        #endregion
+
+        #region ToolTip
+
+        public const string ToolTipPropertyName = "ToolTip";
+        private string _toolTip = string.Empty;
+        public string ToolTip
+        {
+            get { return _toolTip; }
+            set
+            {
+                if (_toolTip == value) return;
+                _toolTip = value;
+                RaisePropertyChanged(() => ToolTip);
+            }
+        }
+
+        #endregion
+
+        #endregion
+
+        #region Commands
+
+
+        private void ToggleListener()
+        {
+            if (null == _listener) return;
+
+            if (_listener.IsListening)
+            {
+                Task.Factory.StartNew(_listener.Stop);
+            } 
+            else
+            {
+                Task.Factory.StartNew(_listener.Start);
+            }
+        }
+
+        #endregion
+    }
+}
--- a/Messaging/Server/EndPoints/RabbitEndPoint.cs	Wed Mar 21 20:29:04 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,20 +0,0 @@
-using Common.Messages;
-using GalaSoft.MvvmLight.Messaging;
-using Server.Interfaces;
-
-namespace Server.EndPoints
-{
-    public class RabbitEndPoint : BaseEndPoint
-    {
-        public RabbitEndPoint(IListener listener) : base(listener)
-        {
-            Init();
-        }
-
-        public override sealed void Init()
-        {
-            Messenger.Default.Register<RabbitLogMessage>(this, LogMessageReceived);
-            Messenger.Default.Register<RabbitClientMessage>(this, ClientMessageReceived);
-        }
-    }
-}
--- a/Messaging/Server/EndPoints/RabbitProtoEndPoint.cs	Wed Mar 21 20:29:04 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,19 +0,0 @@
-using Common.Messages;
-using GalaSoft.MvvmLight.Messaging;
-using Server.Interfaces;
-
-namespace Server.EndPoints
-{
-    public class RabbitProtoEndPoint : BaseEndPoint
-    {
-        public RabbitProtoEndPoint(IListener listener) : base(listener)
-        {
-            Init();
-        }
-
-        public override sealed void Init()
-        {
-            Messenger.Default.Register<RabbitProtoLogMessage>(this, LogMessageReceived);
-        }
-    }
-}
--- a/Messaging/Server/EndPoints/SocketEndPoint.cs	Wed Mar 21 20:29:04 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,19 +0,0 @@
-using Common.Messages;
-using GalaSoft.MvvmLight.Messaging;
-using Server.Interfaces;
-
-namespace Server.EndPoints
-{
-    public class SocketEndPoint : BaseEndPoint
-    {
-        public SocketEndPoint(IListener listener) : base(listener)
-        {
-            Init();
-        }
-
-        public override sealed void Init()
-        {
-            Messenger.Default.Register<SocketLogMessage>(this, LogMessageReceived);
-        }
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Messaging/Server/Listeners/MsmqListener.cs	Wed Mar 21 22:09:18 2012 +0000
@@ -0,0 +1,57 @@
+using System;
+using System.Messaging;
+using Common.Messages;
+using GalaSoft.MvvmLight.Messaging;
+using Server.Interfaces;
+
+namespace Server.Listeners
+{
+    public class MsmqListener : IListener
+    {
+        public bool IsListening { get; set; }
+
+        private readonly MessageQueue _mq;
+
+        public MsmqListener(string queueName)
+        {
+            _mq = MessageQueue.Exists(queueName)
+                ? new MessageQueue(queueName)
+                : MessageQueue.Create(queueName);
+
+            _mq.Formatter = new XmlMessageFormatter(new Type[] { typeof(string) });
+        }
+
+        public void Start()
+        {
+            if (IsListening) return;
+
+            Messenger.Default.Send(new MsmqLogMessage() { Body = "Opening listener..." });
+            IsListening = true;
+            while (IsListening)
+            {
+                try
+                {
+                    var message = _mq.Receive().Body;
+                    Messenger.Default.Send(new MsmqClientMessage());
+                }
+                catch (MessageQueueException mqe)
+                {
+                    Messenger.Default.Send(new MsmqLogMessage() { Body = mqe.Message });
+                }
+                catch (Exception e)
+                {
+                    Messenger.Default.Send(new MsmqLogMessage() { Body = e.Message });
+                }
+            }
+        }
+
+        public void Stop()
+        {
+            if (!IsListening) return;
+            Messenger.Default.Send(new MsmqLogMessage() { Body = "Closing listener..." });
+            _mq.Close();
+            IsListening = false;
+            Messenger.Default.Send(new MsmqLogMessage() { Body = "Closed." });
+        }
+    }
+}
--- a/Messaging/Server/Server.csproj	Wed Mar 21 20:29:04 2012 +0000
+++ b/Messaging/Server/Server.csproj	Wed Mar 21 22:09:18 2012 +0000
@@ -62,6 +62,7 @@
       <HintPath>..\Libs\RabbitMq.2.6.1.0\RabbitMQ.Client.dll</HintPath>
     </Reference>
     <Reference Include="System" />
+    <Reference Include="System.Messaging" />
     <Reference Include="System.Windows.Interactivity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
       <HintPath>..\Libs\Elysium.Theme.1.3\System.Windows.Interactivity.dll</HintPath>
     </Reference>
@@ -80,14 +81,12 @@
       <SubType>Designer</SubType>
     </ApplicationDefinition>
     <Compile Include="Converters\ToggleButtonToTextConverter.cs" />
-    <Compile Include="EndPoints\RabbitEndPoint.cs" />
-    <Compile Include="EndPoints\RabbitProtoEndPoint.cs" />
-    <Compile Include="EndPoints\SocketEndPoint.cs" />
     <Compile Include="Interfaces\IListener.cs" />
+    <Compile Include="Listeners\MsmqListener.cs" />
     <Compile Include="Locator.cs" />
     <Compile Include="Listeners\RabbitQueueListener.cs" />
     <Compile Include="UI\MainWindowViewModel.cs" />
-    <Compile Include="EndPoints\BaseEndPoint.cs" />
+    <Compile Include="EndPoints\MessageEndPoint.cs" />
     <Page Include="UI\MainWindow.xaml">
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
--- a/Messaging/Server/UI/MainWindow.xaml	Wed Mar 21 20:29:04 2012 +0000
+++ b/Messaging/Server/UI/MainWindow.xaml	Wed Mar 21 22:09:18 2012 +0000
@@ -32,9 +32,9 @@
                 <ToggleButton Grid.Row="0"
                               Grid.Column="0"
                               Margin="10,10,10,0"
-                              Content="{Binding SocketEndPoint.IsListening,
+                              Content="{Binding MsmqEndPoint.IsListening,
                                                 Converter={converters:ToggleButtonToTextConverter}}"
-                              IsChecked="{Binding SocketEndPoint.IsListening}"
+                              IsChecked="{Binding MsmqEndPoint.IsListening}"
                               IsEnabled="True"
                               IsThreeState="False" />
 
@@ -57,13 +57,13 @@
                 <c:MessageTile Grid.Row="1"
                                Grid.Column="0"
                                Background="{StaticResource MetroPurpleBrush}"
-                               DisplayCount="{Binding SocketEndPoint.DisplayCount,
+                               DisplayCount="{Binding MsmqEndPoint.DisplayCount,
                                                       Mode=TwoWay,
                                                       UpdateSourceTrigger=PropertyChanged}"
                                DisplayIcon="{StaticResource Mail}"
-                               DisplayText="{Binding SocketEndPoint.DisplayText}"
+                               DisplayText="{Binding MsmqEndPoint.DisplayText}"
                                Foreground="White"
-                               ToolTip="{Binding SocketEndPoint.ToolTip}" />
+                               ToolTip="{Binding MsmqEndPoint.ToolTip}" />
 
                 <c:MessageTile Grid.Row="1"
                                Grid.Column="1"
@@ -84,11 +84,11 @@
                                ToolTip="{Binding RabbitProtoEndPoint.ToolTip}" />
                 <ScrollViewer Grid.Row="2"
                               Grid.Column="0"
-                              Xaml:XamlHelper.AutoScroll="{Binding SocketEndPoint.IsLogChanged}">
+                              Xaml:XamlHelper.AutoScroll="{Binding MsmqEndPoint.IsLogChanged}">
                     <TextBlock Margin="10"
                                Background="{StaticResource MetroGrayBrush}"
                                Padding="10"
-                               Text="{Binding SocketEndPoint.DisplayLog}"
+                               Text="{Binding MsmqEndPoint.DisplayLog}"
                                TextWrapping="Wrap" />
                 </ScrollViewer>
                 <ScrollViewer Grid.Row="2"
--- a/Messaging/Server/UI/MainWindowViewModel.cs	Wed Mar 21 20:29:04 2012 +0000
+++ b/Messaging/Server/UI/MainWindowViewModel.cs	Wed Mar 21 22:09:18 2012 +0000
@@ -1,6 +1,7 @@
 using System.Windows.Input;
 using Common;
 using Common.Logger;
+using Common.Messages;
 using GalaSoft.MvvmLight;
 using GalaSoft.MvvmLight.Command;
 using System.Windows;
@@ -36,16 +37,18 @@
 
         public ICommand CloseCommand { get; set; }
 
-        public BaseEndPoint SocketEndPoint { get; set; }
-        public BaseEndPoint RabbitEndPoint { get; set; }
-        public BaseEndPoint RabbitProtoEndPoint { get; set; }
+        public MessageEndPoint<MsmqClientMessage, MsmqLogMessage> MsmqEndPoint { get; set; }
+        public MessageEndPoint<SocketClientMessage, SocketLogMessage> SocketEndPoint { get; set; }
+        public MessageEndPoint<RabbitClientMessage, RabbitLogMessage> RabbitEndPoint { get; set; }
+        public MessageEndPoint<RabbitProtoClientMessage, RabbitProtoLogMessage> RabbitProtoEndPoint { get; set; }
 
         #region Constructor
 
         public MainWindowViewModel()
         {
-            InitSocketEndPoint(Settings.SocketsPortNumber);
-            InitRabbitEndPoint(Settings.RabbitPortNumber, Settings.QueueName);
+            InitMsmqEndPoint(Settings.MsmqQueueName);
+            //InitSocketEndPoint(Settings.SocketsPortNumber);
+            InitRabbitEndPoint(Settings.RabbitPortNumber, Settings.RabbitQueueName);
             InitRabbitProtoEndPoint(Settings.RabbitProtoPortNumber);
 
             CloseCommand = new RelayCommand(CloseCommandExecute);
@@ -53,10 +56,20 @@
 
         #endregion
 
+        private void InitMsmqEndPoint(string queueName)
+        {
+            IListener listener = new MsmqListener(queueName);
+            MsmqEndPoint = new MessageEndPoint<MsmqClientMessage, MsmqLogMessage>(listener)
+            {
+                DisplayText = "Microsoft Message Queue",
+                ToolTip = string.Format("Listening on msmq queue ({0})", queueName)
+            };
+        }
+
         private void InitSocketEndPoint(int port)
         {
             IListener listener = new AsyncSocketListener(port);
-            SocketEndPoint = new SocketEndPoint(listener)
+            SocketEndPoint = new MessageEndPoint<SocketClientMessage, SocketLogMessage>(listener)
             {
                 DisplayText = "Async Sockets",
                 ToolTip = "Listening over TCP/IP on socket localhost:" + port
@@ -66,7 +79,7 @@
         private void InitRabbitEndPoint(int port, string queueName)
         {
             IListener listener = new RabbitQueueListener(port, queueName);
-            RabbitEndPoint = new RabbitEndPoint(listener)
+            RabbitEndPoint = new MessageEndPoint<RabbitClientMessage, RabbitLogMessage>(listener)
             {
                 DisplayText = "RabbitMQ",
                 ToolTip = "Listening..." + port
@@ -76,12 +89,13 @@
         private void InitRabbitProtoEndPoint(int port)
         {
             IListener listener = null;
-            RabbitProtoEndPoint = new RabbitProtoEndPoint(listener)
+            RabbitProtoEndPoint = new MessageEndPoint<RabbitProtoClientMessage, RabbitProtoLogMessage>(listener)
             {
                 DisplayText = "RabbitMQ with Protobuf-net",
                 ToolTip = "Listening...." + port
             };
         }
+
         private void CloseCommandExecute()
         {
             Log.Write("Closing command executed");