| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- using System;
- using System.Collections.Generic;
- using Library;
- using System.Linq;
- using System.Threading;
- using RabbitMQ.Client;
- using System.Text;
- namespace MySystem
- {
- public class KxsActService
- {
- public readonly static KxsActService Instance = new KxsActService();
- private KxsActService()
- { }
- public void Start()
- {
- Thread th = new Thread(dosomething);
- th.IsBackground = true;
- th.Start();
- }
- public void dosomething()
- {
- while (true)
- {
- string content = RedisDbconn.Instance.RPop<string>("KxsActQueue");
- if (!string.IsNullOrEmpty(content))
- {
- try
- {
- // RabbitMQClient.Instance.SendMsg3(content, "QUEUE_KXS_ACT_DIVISION");
- }
- catch (Exception ex)
- {
- Utils.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)
- {
- Utils.WriteLog(DateTime.Now.ToString() + "\r\n" + ex.ToString(), "推送客小爽码牌激活数据异常");
- }
- }
- else
- {
- Thread.Sleep(500);
- }
- }
- }
- }
- }
|