Przeglądaj źródła

小爽激活队列和码牌分开

lcl 1 rok temu
rodzic
commit
0fc31cd5f1
2 zmienionych plików z 33 dodań i 1 usunięć
  1. 32 1
      AppStart/Service/KxsActService.cs
  2. 1 0
      Startup.cs

+ 32 - 1
AppStart/Service/KxsActService.cs

@@ -25,7 +25,7 @@ namespace MySystem
         {
             while (true)
             {
-                string content = MpRedisDbconn.Instance.RPop<string>("KxsActQueue");
+                string content = RedisDbconn.Instance.RPop<string>("KxsActQueue");
                 if (!string.IsNullOrEmpty(content))
                 {
                     try
@@ -43,5 +43,36 @@ namespace MySystem
                 }
             }
         }
+
+
+        public void StartMp()
+        {
+            Thread th = new Thread(dosomethingMp);
+            th.IsBackground = true;
+            th.Start();
+        }
+
+        public void dosomethingMp()
+        {
+            while (true)
+            {
+                string content = MpRedisDbconn.Instance.RPop<string>("KxsActQueue");
+                if (!string.IsNullOrEmpty(content))
+                {
+                    try
+                    {
+                        RabbitMQClient.Instance.SendMsg3(content, "QUEUE_KXS_ACT_DIVISION");
+                    }
+                    catch (Exception ex)
+                    {                        
+                        function.WriteLog(DateTime.Now.ToString() + "\r\n" + ex.ToString(), "推送客小爽码牌激活数据异常");
+                    }
+                }
+                else
+                {
+                    Thread.Sleep(500);
+                }
+            }
+        }
     }
 }

+ 1 - 0
Startup.cs

@@ -141,6 +141,7 @@ namespace MySystem
             MpMerchantActService.Instance.Start();
             KxsOrderService.Instance.Start();
             KxsActService.Instance.Start();
+            KxsActService.Instance.StartMp();
         }
     }
 }