comparison 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
comparison
equal deleted inserted replaced
27:96fdf58e05b4 28:4c0dea4760c5
8 using System.Windows.Input; 8 using System.Windows.Input;
9 using System.Windows.Media; 9 using System.Windows.Media;
10 using System.Windows.Media.Imaging; 10 using System.Windows.Media.Imaging;
11 using System.Windows.Navigation; 11 using System.Windows.Navigation;
12 using System.Windows.Shapes; 12 using System.Windows.Shapes;
13 using Common;
14 using RabbitMQ.Client;
13 15
14 namespace Client 16 namespace Client
15 { 17 {
16 /// <summary> 18 /// <summary>
17 /// Interaction logic for MainWindow.xaml 19 /// Interaction logic for MainWindow.xaml
20 { 22 {
21 public MainWindow() 23 public MainWindow()
22 { 24 {
23 InitializeComponent(); 25 InitializeComponent();
24 } 26 }
27
28 private void BtnRabbitClick(object sender, RoutedEventArgs e)
29 {
30 Task
31 var cf = new ConnectionFactory {Address = "localhost:" + Settings.RabbitPortNumber};
32
33 using (var conn = cf.CreateConnection())
34 using (var channel = conn.CreateModel())
35 {
36 for (var i = 0; i < 10000; i++)
37 {
38 channel.BasicPublish("amq.direct", Settings.QueueName, null,
39 Encoding.UTF8.GetBytes("hello from the client!"));
40 }
41 }
42 }
25 } 43 }
26 } 44 }