Beispiel #1
0
        static void Main(string[] args)
        {
            Console.WriteLine("开始往集群中发布消息...");
            using (var rabbitmqProxy = new RabbitMQWrapper())
            {
                for (int i = 0; i < Int32.MaxValue; i++)
                {
                    try
                    {
                        var debugLog = new DebugLog
                        {
                            Id          = i,
                            CreatedTime = DateTime.Now
                        };

                        rabbitmqProxy.Publish(debugLog);
                        Console.WriteLine(string.Format("{0} OK", i));

                        System.Threading.Thread.Sleep(1 * 1000);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message);
                    }
                }
            }
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            for (int i = 1; i < 5; i++)
            {
                UserInfo userinfo = new UserInfo {
                    UserName = "******" + i.ToString(), Password = "******"
                };
                RabbitMQWrapper.Publish(userinfo);
            }

            RabbitMQWrapper.Subscribe <UserInfo>(x =>
            {
                System.Console.WriteLine(x.UserName);
            });

            System.Console.ReadLine();
        }
Beispiel #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     RabbitMQWrapper.Publish(new Object());
 }