// message queue private static void AddToMessageQueue(string queue, Order order) { var session = MqSession.GetInstance().Session; IDestination destination = SessionUtil.GetDestination(session, queue); using (IMessageProducer producer = session.CreateProducer(destination)) { producer.DeliveryMode = MsgDeliveryMode.Persistent; var content = JsonConvert.SerializeObject(order); ITextMessage request = session.CreateTextMessage(content); producer.Send(request); } }
static void Main(string[] args) { Console.Title = "Processor"; Console.WindowWidth = 100; _mqSession = new MqSession(Url.BROKER_URL); // setup listeners CreateConsumer(Queue.API_ORDERS_POST).Listener += new Orders(_mqSession).OnOrderPostReceived; CreateConsumer(Queue.API_ORDERS_GET).Listener += new Orders(_mqSession).OnOrderGetReceived; // main loop while (true) { Thread.Sleep(_sleepMs); } }