Browse Source

测试mq,已通

lcl 5 months ago
parent
commit
14c860c7c6
3 changed files with 4 additions and 2 deletions
  1. 1 1
      Common/RabbitMQClient.cs
  2. 2 0
      Program.cs
  3. 1 1
      appsettings.Development.json

+ 1 - 1
Common/RabbitMQClient.cs

@@ -64,7 +64,7 @@ namespace MySystem
             {
                 string MsgContent = Encoding.Default.GetString(e.Body.ToArray());
                 Function.WriteLog(MsgContent, "接收mq数据队列");
-                PrizeDo.sendPrize(MsgContent);
+                // PrizeDo.sendPrize(MsgContent);
                 channel.BasicAck(e.DeliveryTag, true); //收到回复后,RabbitMQ会直接在队列中删除这条消息
             };
             channel.BasicConsume(QueueName, false, consumer);

+ 2 - 0
Program.cs

@@ -10,6 +10,7 @@ using Microsoft.AspNetCore.Mvc;
 using Microsoft.AspNetCore.Server.Kestrel.Core;
 using Microsoft.Extensions.FileProviders;
 using Middleware;
+using MySystem;
 using Services;
 using SummerBoot.Core;
 using Util;
@@ -128,6 +129,7 @@ app.MapControllers();
 // PrizeDo.sendPrize(7, "{\"OrderNo\":\"BM2024090817330511847441249\"}");
 // PrizeDo.sendPrize(7, "{\"OrderNo\":\"BM2024090817360962275551251\"}");
 
+RabbitMQClient.Instance.StartReceive("PRIZE_SEND_QUEUE", "PRIZE_SEND_QUEUE", "/");
 
 
 app.Run();

+ 1 - 1
appsettings.Development.json

@@ -43,7 +43,7 @@
   "MqSettings": {
     "UserName": "admin",
     "Password": "admin",
-    "HostName": "47.109.61.191:5672",
+    "HostName": "47.108.62.166:5672",
     "VirtualHostName": "/"
   },
   "InitDb": false, //是否初始化db