Mercurial > silverbladetech
diff Messaging/Client/MainWindow.xaml.cs @ 28:4c0dea4760c5
RabbitMq working
author | adminsh@apollo |
---|---|
date | Wed, 21 Mar 2012 20:29:04 +0000 |
parents | 045dac571339 |
children | 9919ee227c93 |
line wrap: on
line diff
--- a/Messaging/Client/MainWindow.xaml.cs Wed Mar 21 19:00:59 2012 +0000 +++ b/Messaging/Client/MainWindow.xaml.cs Wed Mar 21 20:29:04 2012 +0000 @@ -10,6 +10,8 @@ using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; +using Common; +using RabbitMQ.Client; namespace Client { @@ -22,5 +24,21 @@ { InitializeComponent(); } + + private void BtnRabbitClick(object sender, RoutedEventArgs e) + { + Task + var cf = new ConnectionFactory {Address = "localhost:" + Settings.RabbitPortNumber}; + + using (var conn = cf.CreateConnection()) + using (var channel = conn.CreateModel()) + { + for (var i = 0; i < 10000; i++) + { + channel.BasicPublish("amq.direct", Settings.QueueName, null, + Encoding.UTF8.GetBytes("hello from the client!")); + } + } + } } -} +} \ No newline at end of file