public RocketMqMessageQueueTest() { //118.24.153.159:9876 //220.167.101.61 10911 9876 a = new Dcp.Net.MQ.RocketMQ.RocketMQManager(new Dcp.Net.MQ.RocketMQ.Configuration.RocketMQItemConfig() { Server = "220.167.101.49:9876",// "220.167.101.61:9876", //"118.24.153.159:9876",// ConsumeThreadNums = Environment.ProcessorCount * 2, ProducerID = "testProducerID", ConsumerID = "testConsumerID", Topic = "testTopic", }); int i = 0; a.Start(new Action <MQMessage>((msg) => { i++; try { if (i == 10000) { Console.WriteLine("接收消息数:=>" + i); } // Console.Clear(); // Console.WriteLine($"收到消息=>{msg.Body}"); } catch (Exception ex) { Console.WriteLine(ex); } })); }
public RocketMqMessageQueue() { //118.24.153.159:9876 //220.167.101.61 10911 9876 a = new Dcp.Net.MQ.RocketMQ.RocketMQManager(new Dcp.Net.MQ.RocketMQ.Configuration.RocketMQItemConfig() { Server = "220.167.103.49:9873", ConsumeThreadNums = Environment.ProcessorCount * 2, ProducerID = "testProducerID", ConsumerID = "testConsumerID", Topic = "testTopic", }); //a.Consumer.StartListener(new System.Action<MQMessage>((msg)=> { // System.Console.WriteLine(msg.Body); //})); // a.Consumer.Start(messageLister); a.Product.Start(); a.Product.Send("测试发生", "tag", "key"); }