view 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 source

using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Common;
using RabbitMQ.Client;

namespace Client
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            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!"));
                }
            }
        }
    }
}