private static void SendEventMessage() { var originObject = new UpdatePurchaseOrderStatusByBillIdMqContract() { UpdatePurchaseOrderStatusType = 1, RelationBillType = 10, RelationBillId = 10016779, UpdateStatus = 30, ModifiedBy = 100 }; var sendMessage = EventMessageFactory.CreateEventMessageInstance(originObject, "Test"); RabbitMqClient.Instance.TriggerEventMessage(sendMessage, "", "Demo.J"); //for (int i = 0; i < 100; i++) //{ // var originObject = new UpdatePurchaseOrderStatusByBillIdMqContract() // { // UpdatePurchaseOrderStatusType = 1, // RelationBillType = 10, // RelationBillId = 10016779, // UpdateStatus = 30, // ModifiedBy = i // }; // var sendMessage = EventMessageFactory.CreateEventMessageInstance(originObject, "Test"); // RabbitMqClient.Instance.TriggerEventMessage(sendMessage, "Demo.Purchase", "Demo.Purchase"); //} }
/// <summary> /// Send /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button1_Click(object sender, EventArgs e) { object originObject = Guid.NewGuid().ToString() + "AUTO"; var sendMessage = EventMessageFactory.CreateEventMessageInstance(originObject, "AUTO"); AutoMQClient.Instance.TriggerEventMessage(sendMessage, "AUTO", "AUTO"); //var conn = new ConnectionFactory() { HostName = "127.0.0.1" }; //using (var connmodel = conn.CreateConnection()) //{ // using (var channel = connmodel.CreateModel()) // { // channel.QueueDeclare(queue: "CALC", // durable: false, // exclusive: false, // autoDelete: false, // arguments: null); // string messageGUID = Guid.NewGuid().ToString(); // textBox1.Text = messageGUID; // var body = Encoding.UTF8.GetBytes(messageGUID); // channel.BasicPublish(exchange: "", // routingKey: "CALC", // basicProperties: null, // body: body); // //MessageBox.Show("send"+ messageGUID); // } //} }
/// <summary> /// 向消息队列发送有关QuestionsLibraryAndSort添加或删除的消息 /// </summary> /// <param name="mi"></param> public static void SendEventMessageByQuestionsLibraryAndSort(MessageInfo mi) { var sendMessage = EventMessageFactory.CreateEventMessageInstance <MessageInfo>(mi, MessageType.Markcode); RabbitMqClient.Instance.TriggerEventMessage(sendMessage, "", RabbitMQCMSRedBag); //EventLog.Log("添加消息:" + mi.Content, "mq"); }
private static void SendEventMessage() { var originObject = new UpdatePurchaseOrderStatusByBillIdMqContract() { UpdatePurchaseOrderStatusType = 1, RelationBillType = 10, RelationBillId = 10016779, UpdateStatus = 30, ModifiedBy = 11 }; var sendMessage = EventMessageFactory.CreateEventMessageInstance(originObject, MessageTypeConst.ZgUpdatePurchaseStatus); var mqConfigDomFactory = MqConfigDomFactory.CreateConfigDomInstance(); RabbitMqClient.Instance.TriggerEventMessage(sendMessage, mqConfigDomFactory.MqExchangeName, mqConfigDomFactory.MqListenQueueName); Console.WriteLine(11); }
private static void SendEventMessage() { for (var i = 1; i < 10000; i++) { var originObject = new UpdatePurchaseOrderStatusByBillIdMqContract() { UpdatePurchaseOrderStatusType = 1, RelationBillType = 10, RelationBillId = 10016779, UpdateStatus = 30, ModifiedBy = i }; var sendMessage = EventMessageFactory.CreateEventMessageInstance(originObject, MessageTypeConst.ZgUpdatePurchaseStatus); RabbitMqClient.Instance.TriggerEventMessage(sendMessage, "CMQ.Purchase", "CMQ.Purchase"); Console.WriteLine(i); } }