A message retrieved from an IronMQ queue.
Esempio n. 1
0
 /// <summary>
 /// Delete message from the queue. 
 /// Be sure you call this after you’re done with a message otherwise it will be placed back on the queue.
 /// </summary>
 public async Task<bool> DeleteMessageAsync(Message message)
 {
     var response = await _client.DeleteAsync(string.Format("queues/{0}/messages/{1}", Name, message.ID));
     return response.IsSuccessStatusCode;
 }
Esempio n. 2
0
 /// <summary>
 /// Status of push notifications.
 /// </summary>
 public async Task<PushInfo[]> GetPushStatusAsync(Message message)
 {
     var response = await _client.GetAsync(string.Format("queues/{0}/messages/{1}/subscribers", Name, message.ID));
     var content = await response.Content.ReadAsStringAsync();
     var json = ((JsonObject.Parse(content)["subscribers"] as JsonArray) as IEnumerable<JsonValue>);
     return json.Select(info => new PushInfo(info)).ToArray();
 }
Esempio n. 3
0
 /// <summary>
 /// Touching a reserved message extends its timeout by the duration specified when the message was created, 
 /// which is 60 seconds by default.
 /// </summary>
 public async Task<bool> TouchMessageAsync(Message message, long delay = 60)
 {
     var content = new JsonContent();
     var response = await _client.PostAsync(string.Format("queues/{0}/messages/{1}/touch", Name, message.ID), content);
     return response.IsSuccessStatusCode;
 }