| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- using System;
- using System.Collections.Generic;
- using Library;
- using System.Linq;
- using System.Threading;
- using RabbitMQ.Client;
- using System.Text;
- namespace MySystem
- {
- public class KxsOrderService
- {
- public readonly static KxsOrderService Instance = new KxsOrderService();
- private KxsOrderService()
- { }
- public void Start()
- {
- Thread th = new Thread(dosomething);
- th.IsBackground = true;
- th.Start();
- }
- public void dosomething()
- {
- while (true)
- {
- string content = RedisDbconn.Instance.RPop<string>("KxsOrderQueue");
- if (!string.IsNullOrEmpty(content))
- {
- try
- {
- RabbitMQClient.Instance.SendMsg2(content, "QUEUE_KXS_ORDER_DIVISION");
- }
- catch (Exception ex)
- {
- Utils.WriteLog(DateTime.Now.ToString() + "\r\n" + ex.ToString(), "客小爽订单推送异常");
- }
- }
- else
- {
- Thread.Sleep(500);
- }
- }
- }
- }
- }
|