Example #1
0
 public void SendMessage(MessagePumpModel message)
 {
     try
     {
         logger.Debug("Sending message: {0} - {1}", message.Id, message.Message);
         SendMessageRequest  request  = new SendMessageRequest(QUEUE_URL, JsonConvert.SerializeObject(message));
         SendMessageResponse response = _client.SendMessage(request);
         logger.Debug("Message sent with status code: {0}", response.HttpStatusCode);
     }
     catch (Exception ex)
     {
         logger.Error("Send message failed: {0}", ex.ToString());
     }
 }
Example #2
0
        public static void Main(string[] args)
        {
            MessagePumpService service = new MessagePumpService();

            for (var i = 0; i < 30; i++)
            {
                MessagePumpModel model = new MessagePumpModel()
                {
                    Id      = Guid.NewGuid(),
                    Message = string.Format("Hello World {0}; {1}", i, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff")),
                };
                service.SendMessage(model);
            }

            Console.ReadLine();
        }