|
|
@@ -1,78 +0,0 @@
|
|
|
-using System;
|
|
|
-using System.Collections.Generic;
|
|
|
-using Library;
|
|
|
-using System.Linq;
|
|
|
-using System.Threading;
|
|
|
-using RabbitMQ.Client;
|
|
|
-using System.Text;
|
|
|
-
|
|
|
-namespace MySystem
|
|
|
-{
|
|
|
- public class KxsPosPushService
|
|
|
- {
|
|
|
- public readonly static KxsPosPushService Instance = new KxsPosPushService();
|
|
|
- private KxsPosPushService()
|
|
|
- { }
|
|
|
-
|
|
|
- public void Start()
|
|
|
- {
|
|
|
- Thread th = new Thread(dosomething);
|
|
|
- th.IsBackground = true;
|
|
|
- th.Start();
|
|
|
- }
|
|
|
-
|
|
|
- public void dosomething()
|
|
|
- {
|
|
|
- while (true)
|
|
|
- {
|
|
|
- string content = RedisDbconn.Instance.RPop<string>("KxsPosDataQueue");
|
|
|
- if (!string.IsNullOrEmpty(content))
|
|
|
- {
|
|
|
- try
|
|
|
- {
|
|
|
- RabbitMQClient.Instance.PushPosData(content, "");
|
|
|
- }
|
|
|
- catch (Exception ex)
|
|
|
- {
|
|
|
- function.WriteLog(DateTime.Now.ToString() + "\r\n" + ex.ToString(), "推送客小爽机具数据异常");
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- Thread.Sleep(500);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- 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);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-}
|