Esempio n. 1
0
        static void Main(string[] args)
        {
            int userCount = 0;

            while (userCount < 10)
            {
                string strUser = "******" + new Random().Next(1, 30);
                ActiveMQHelper.SubscriberTopic(new AQConfig()
                {
                    ActiveMQName = "testaq"
                },
                                               strUser,
                                               (m) =>
                {
                    var msg = ((ITextMessage)m.IMessage);
                    Console.WriteLine(m.custom + "Receive: " + msg.Text);
                });
                Console.WriteLine("用户: " + strUser + "订阅");
                Thread.Sleep(5 * 1000);
            }
            Console.ReadLine();
        }