RabbitMQ怎解?

using System;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace Wenli.Console
{
    using Console = System.Console;

    class Program
    {
        public static object MQConfig { get; private set; }
        public static object RabbitMQBuilder { get; private set; }

        static void Main(string[] args)
        {
            Console.Title = "Wenli.Console";
            Console.WriteLine("正连接到mq");

            try
            {
                Test();
            }
            catch (Exception ex)
            {
                Console.WriteLine("err:" + ex.Message + ex.Source + ex.StackTrace);
            }

            Console.Read();
        }


        static void Test()
        {

            var topic = "testtopic";

            var cnn = RabbitMQBuilder.GetHashCode(MQConfig.Default).GetHashCodeConnection();

            var operation = cnn.GetOperation(topic);

            Console.WriteLine("正连接到订阅【" + topic + "】");

            operation.Subscribe();

            Console.WriteLine("正在入队");

            Task.Factory.StartNew(() =>
            {
                while (true)
                {
                    operation.Enqueue(Encoding.UTF8.GetBytes(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + "   hello!"));
                    Thread.Sleep(1);
                }
            });


            Console.WriteLine("正在出队");

            Task.Factory.StartNew(() =>
            {
                while (true)
                {
                    var result = operation.Dnqueue();

                    if (result == null)
                    {
                        Thread.Sleep(1);
                    }
                    else
                    {
                        Console.WriteLine(Encoding.UTF8.GetString(result));
                    }
                }
            });

            Console.ReadLine();

            Console.WriteLine("正在取消订阅");

            operation.UnSubscribe();

            Console.WriteLine("测试完成");
        }
    }
}


不知道你这个问题是否已经解决, 如果还没有解决的话:

如果你已经解决了该问题, 非常希望你能够分享一下解决方案, 以帮助更多的人 ^-^