using System; using System.Collections.Generic; using Library; using LitJson; using System.Linq; using System.Threading; using System.Text; namespace MySystem { public class PrizeSendService { public readonly static PrizeSendService Instance = new PrizeSendService(); private PrizeSendService() { } public void Start() { Thread th = new Thread(dosomething); th.IsBackground = true; th.Start(); } public void dosomething() { while (true) { string content = RedisDbconn.Instance.RPop("PrizeSendQueue"); if (!string.IsNullOrEmpty(content)) { try { JsonData jsonObj = JsonMapper.ToObject(content); RabbitMQPrize.Instance.SendMsg(jsonObj["content"].ToString(), "PRIZE_SEND_QUEUE_" + jsonObj["prize_tag"].ToString()); } catch (Exception ex) { Utils.WriteLog(DateTime.Now.ToString() + "\r\n" + ex.ToString(), "推送客小爽机具数据异常"); } } else { Thread.Sleep(2000); } } } } }