26
|
1 using System;
|
|
2 using System.Collections.Generic;
|
|
3 using System.Text;
|
|
4 using System.Windows;
|
|
5 using System.Windows.Controls;
|
|
6 using System.Windows.Data;
|
|
7 using System.Windows.Documents;
|
|
8 using System.Windows.Input;
|
|
9 using System.Windows.Media;
|
|
10 using System.Windows.Media.Imaging;
|
|
11 using System.Windows.Navigation;
|
|
12 using System.Windows.Shapes;
|
28
|
13 using Common;
|
|
14 using RabbitMQ.Client;
|
26
|
15
|
|
16 namespace Client
|
|
17 {
|
|
18 /// <summary>
|
|
19 /// Interaction logic for MainWindow.xaml
|
|
20 /// </summary>
|
|
21 public partial class MainWindow : Window
|
|
22 {
|
|
23 public MainWindow()
|
|
24 {
|
|
25 InitializeComponent();
|
|
26 }
|
28
|
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 }
|
26
|
43 }
|
28
|
44 } |