private static string Push (string queueName, string message) { // Notification Notification n = new Notification(); n.Action = "publish"; n.Expires = DateTime.Now.AddHours(1); n.Categories = new Category[2]; n.Categories[0] = new Category(); n.Categories[0].Term = message; n.Categories[1] = new Category(); n.Categories[1].Term = "indie"; // The actual Queue Message to send Message pm = new Message(); pm.Op.Type = OperationType.PushMessage; pm.QueueId = queueName; Console.WriteLine(queueName); Console.WriteLine(n.ToString()); pm.Payload = Convert.ToBase64String(Notification.Serialize(n)); // An event handler MessageEvent me = new MessageEvent(); me.Message = pm; // Let's see what the response of the server was me.MessageReceived += new MessageEventHandler(queue_MessageReceived); QueueClientPool.Enqueue(me); return "message sent"; }
public static byte[] Serialize ( Notification notification, Encoding encoding ) { return encoding.GetBytes(notification.ToString()); }
public static byte[] Serialize ( Notification notification ) { return Encoding.UTF8.GetBytes(notification.ToString()); }