-
Notifications
You must be signed in to change notification settings - Fork 97
Expand file tree
/
Copy pathIQueueingService.cs
More file actions
555 lines (522 loc) · 42.7 KB
/
Copy pathIQueueingService.cs
File metadata and controls
555 lines (522 loc) · 42.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
namespace net.openstack.Core.Providers
{
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Threading.Tasks;
using net.openstack.Core.Collections;
using net.openstack.Core.Domain;
using net.openstack.Core.Domain.Queues;
using Newtonsoft.Json.Linq;
using CancellationToken = System.Threading.CancellationToken;
using CloudQueuesProvider = net.openstack.Providers.Rackspace.CloudQueuesProvider;
using JsonSerializationException = Newtonsoft.Json.JsonSerializationException;
using WebException = System.Net.WebException;
/// <summary>
/// Represents a provider for asynchronous operations on the OpenStack Marconi (Cloud Queues) Service.
/// </summary>
/// <seealso href="https://wiki.openstack.org/w/index.php?title=Marconi/specs/api/v1&oldid=30943">OpenStack Marconi API v1 Blueprint</seealso>
/// <preliminary/>
public interface IQueueingService
{
#region Base endpoints
/// <summary>
/// Gets the home document describing the operations supported by the service.
/// </summary>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that the task will observe.</param>
/// <returns>A <see cref="Task"/> object representing the asynchronous operation. When the task completes successfully, the <see cref="Task{TResult}.Result"/> property will contain a <see cref="HomeDocument"/> object describing the operations supported by the service.</returns>
/// <exception cref="WebException">If the REST request does not return successfully.</exception>
/// <example>
/// <para>The following example demonstrates the use of this method using the <see cref="CloudQueuesProvider"/>
/// implementation of the <see cref="IQueueingService"/>. For more information about creating the provider, see
/// <see cref="CloudQueuesProvider.CloudQueuesProvider(CloudIdentity, string, Guid, bool, IIdentityProvider)"/>.</para>
/// <token>AsyncAwaitExample</token>
/// <code source="..\Samples\CSharpCodeSamples\QueueingServiceExamples.cs" region="GetHomeAsync (await)" language="cs"/>
/// <code source="..\Samples\VBCodeSamples\QueueingServiceExamples.vb" region="GetHomeAsync (await)" language="vbnet"/>
/// <code source="..\Samples\FSharpCodeSamples\QueueingServiceExamples.fs" region="GetHomeAsync (await)" language="fs"/>
/// <token>TplExample</token>
/// <code source="..\Samples\CSharpCodeSamples\QueueingServiceExamples.cs" region="GetHomeAsync (TPL)" language="cs"/>
/// <code source="..\Samples\VBCodeSamples\QueueingServiceExamples.vb" region="GetHomeAsync (TPL)" language="vbnet"/>
/// <code source="..\Samples\CPPCodeSamples\QueueingServiceExamples.cpp" region="GetHomeAsync (TPL)" language="cpp"/>
/// <code source="..\Samples\FSharpCodeSamples\QueueingServiceExamples.fs" region="GetHomeAsync (TPL)" language="fs"/>
/// </example>
/// <seealso href="https://wiki.openstack.org/w/index.php?title=Marconi/specs/api/v1#Get_Home_Document">Get Home Document (OpenStack Marconi API v1 Blueprint)</seealso>
Task<HomeDocument> GetHomeAsync(CancellationToken cancellationToken);
/// <summary>
/// Checks the queueing service node status.
/// </summary>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that the task will observe.</param>
/// <returns>
/// A <see cref="Task"/> object representing the asynchronous operation. If the service
/// is available, the task will complete successfully. If the service is unavailable due
/// to a storage driver failure or some other error, the task will fail and the
/// <see cref="Task.Exception"/> property will contain the reason for the failure.
/// </returns>
/// <exception cref="WebException">If the REST request does not return successfully.</exception>
/// <example>
/// <para>The following example demonstrates the use of this method using the <see cref="CloudQueuesProvider"/>
/// implementation of the <see cref="IQueueingService"/>. For more information about creating the provider, see
/// <see cref="CloudQueuesProvider.CloudQueuesProvider(CloudIdentity, string, Guid, bool, IIdentityProvider)"/>.</para>
/// <token>AsyncAwaitExample</token>
/// <code source="..\Samples\CSharpCodeSamples\QueueingServiceExamples.cs" region="GetNodeHealthAsync (await)" language="cs"/>
/// <code source="..\Samples\VBCodeSamples\QueueingServiceExamples.vb" region="GetNodeHealthAsync (await)" language="vbnet"/>
/// <code source="..\Samples\FSharpCodeSamples\QueueingServiceExamples.fs" region="GetNodeHealthAsync (await)" language="fs"/>
/// <token>TplExample</token>
/// <code source="..\Samples\CSharpCodeSamples\QueueingServiceExamples.cs" region="GetNodeHealthAsync (TPL)" language="cs"/>
/// <code source="..\Samples\VBCodeSamples\QueueingServiceExamples.vb" region="GetNodeHealthAsync (TPL)" language="vbnet"/>
/// <code source="..\Samples\CPPCodeSamples\QueueingServiceExamples.cpp" region="GetNodeHealthAsync (TPL)" language="cpp"/>
/// <code source="..\Samples\FSharpCodeSamples\QueueingServiceExamples.fs" region="GetNodeHealthAsync (TPL)" language="fs"/>
/// </example>
/// <seealso href="https://wiki.openstack.org/wiki/Marconi/specs/api/v1#Check_Node_Health">Check Node Health (OpenStack Marconi API v1 Blueprint)</seealso>
Task GetNodeHealthAsync(CancellationToken cancellationToken);
#endregion Base endpoints
#region Queues
/// <summary>
/// Creates a queue, if it does not already exist.
/// </summary>
/// <param name="queueName">The queue name.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that the task will observe.</param>
/// <returns>A <see cref="Task"/> object representing the asynchronous operation. When the task completes successfully, the <see cref="Task{TResult}.Result"/> property will contain <see langword="true"/> if the queue was created by the call, or <see langword="false"/> if the queue already existed.</returns>
/// <exception cref="ArgumentNullException">If <paramref name="queueName"/> is <see langword="null"/>.</exception>
/// <exception cref="WebException">If the REST request does not return successfully.</exception>
/// <example>
/// <para>The following example demonstrates the use of this method using the <see cref="CloudQueuesProvider"/>
/// implementation of the <see cref="IQueueingService"/>. For more information about creating the provider, see
/// <see cref="CloudQueuesProvider.CloudQueuesProvider(CloudIdentity, string, Guid, bool, IIdentityProvider)"/>.</para>
/// <token>AsyncAwaitExample</token>
/// <code source="..\Samples\CSharpCodeSamples\QueueingServiceExamples.cs" region="CreateQueueAsync (await)" language="cs"/>
/// <code source="..\Samples\VBCodeSamples\QueueingServiceExamples.vb" region="CreateQueueAsync (await)" language="vbnet"/>
/// <code source="..\Samples\FSharpCodeSamples\QueueingServiceExamples.fs" region="CreateQueueAsync (await)" language="fs"/>
/// <token>TplExample</token>
/// <code source="..\Samples\CSharpCodeSamples\QueueingServiceExamples.cs" region="CreateQueueAsync (TPL)" language="cs"/>
/// <code source="..\Samples\VBCodeSamples\QueueingServiceExamples.vb" region="CreateQueueAsync (TPL)" language="vbnet"/>
/// <code source="..\Samples\CPPCodeSamples\QueueingServiceExamples.cpp" region="CreateQueueAsync (TPL)" language="cpp"/>
/// <code source="..\Samples\FSharpCodeSamples\QueueingServiceExamples.fs" region="CreateQueueAsync (TPL)" language="fs"/>
/// </example>
/// <seealso href="https://wiki.openstack.org/w/index.php?title=Marconi/specs/api/v1#Create_Queue">Create Queue (OpenStack Marconi API v1 Blueprint)</seealso>
Task<bool> CreateQueueAsync(QueueName queueName, CancellationToken cancellationToken);
/// <summary>
/// Gets a list of queues.
/// </summary>
/// <param name="marker">The name of the last queue in the previous list. The resulting collection of queues will start with the first queue <em>after</em> this value, when sorted using <see cref="StringComparer.Ordinal"/>. If this value is <see langword="null"/>, the list starts at the beginning.</param>
/// <param name="limit">The maximum number of queues to return. If this value is <see langword="null"/>, a provider-specific default value is used.</param>
/// <param name="detailed"><see langword="true"/> to return detailed information about each queue; otherwise, <see langword="false"/>.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that the task will observe.</param>
/// <returns>A <see cref="Task"/> object representing the asynchronous operation. When the task completes successfully, the <see cref="Task{TResult}.Result"/> property will contain <placeholder>placeholder</placeholder>.</returns>
/// <exception cref="ArgumentOutOfRangeException">If <paramref name="limit"/> is less than or equal to 0.</exception>
/// <exception cref="WebException">If the REST request does not return successfully.</exception>
/// <example>
/// <para>The following example demonstrates the use of this method using the <see cref="CloudQueuesProvider"/>
/// implementation of the <see cref="IQueueingService"/>. For more information about creating the provider, see
/// <see cref="CloudQueuesProvider.CloudQueuesProvider(CloudIdentity, string, Guid, bool, IIdentityProvider)"/>.</para>
/// <token>AsyncAwaitExample</token>
/// <code source="..\Samples\CSharpCodeSamples\QueueingServiceExamples.cs" region="ListQueuesAsync (await)" language="cs"/>
/// <code source="..\Samples\VBCodeSamples\QueueingServiceExamples.vb" region="ListQueuesAsync (await)" language="vbnet"/>
/// <code source="..\Samples\FSharpCodeSamples\QueueingServiceExamples.fs" region="ListQueuesAsync (await)" language="fs"/>
/// <token>TplExample</token>
/// <code source="..\Samples\CSharpCodeSamples\QueueingServiceExamples.cs" region="ListQueuesAsync (TPL)" language="cs"/>
/// <code source="..\Samples\VBCodeSamples\QueueingServiceExamples.vb" region="ListQueuesAsync (TPL)" language="vbnet"/>
/// <code source="..\Samples\CPPCodeSamples\QueueingServiceExamples.cpp" region="ListQueuesAsync (TPL)" language="cpp"/>
/// <code source="..\Samples\FSharpCodeSamples\QueueingServiceExamples.fs" region="ListQueuesAsync (TPL)" language="fs"/>
/// </example>
/// <seealso href="https://wiki.openstack.org/w/index.php?title=Marconi/specs/api/v1#List_Queues">List Queues (OpenStack Marconi API v1 Blueprint)</seealso>
Task<ReadOnlyCollectionPage<CloudQueue>> ListQueuesAsync(QueueName marker, int? limit, bool detailed, CancellationToken cancellationToken);
/// <summary>
/// Checks for the existence of a queue with a particular name.
/// </summary>
/// <param name="queueName">The queue name.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that the task will observe.</param>
/// <returns>A <see cref="Task"/> object representing the asynchronous operation. When the task completes successfully, the <see cref="Task{TResult}.Result"/> property will contain <see langword="true"/> if queue with the specified name exists; otherwise, <see langword="false"/>.</returns>
/// <exception cref="ArgumentNullException">If <paramref name="queueName"/> is <see langword="null"/>.</exception>
/// <exception cref="WebException">If the REST request does not return successfully.</exception>
/// <example>
/// <para>The following example demonstrates the use of this method using the <see cref="CloudQueuesProvider"/>
/// implementation of the <see cref="IQueueingService"/>. For more information about creating the provider, see
/// <see cref="CloudQueuesProvider.CloudQueuesProvider(CloudIdentity, string, Guid, bool, IIdentityProvider)"/>.</para>
/// <token>AsyncAwaitExample</token>
/// <code source="..\Samples\CSharpCodeSamples\QueueingServiceExamples.cs" region="QueueExistsAsync (await)" language="cs"/>
/// <code source="..\Samples\VBCodeSamples\QueueingServiceExamples.vb" region="QueueExistsAsync (await)" language="vbnet"/>
/// <code source="..\Samples\FSharpCodeSamples\QueueingServiceExamples.fs" region="QueueExistsAsync (await)" language="fs"/>
/// <token>TplExample</token>
/// <code source="..\Samples\CSharpCodeSamples\QueueingServiceExamples.cs" region="QueueExistsAsync (TPL)" language="cs"/>
/// <code source="..\Samples\VBCodeSamples\QueueingServiceExamples.vb" region="QueueExistsAsync (TPL)" language="vbnet"/>
/// <code source="..\Samples\CPPCodeSamples\QueueingServiceExamples.cpp" region="QueueExistsAsync (TPL)" language="cpp"/>
/// <code source="..\Samples\FSharpCodeSamples\QueueingServiceExamples.fs" region="QueueExistsAsync (TPL)" language="fs"/>
/// </example>
/// <seealso href="https://wiki.openstack.org/w/index.php?title=Marconi/specs/api/v1#Checking_Queue_Existence">Checking Queue Existence (OpenStack Marconi API v1 Blueprint)</seealso>
Task<bool> QueueExistsAsync(QueueName queueName, CancellationToken cancellationToken);
/// <summary>
/// Deletes a queue.
/// </summary>
/// <remarks>
/// The queue will be deleted whether or not it is empty, even if one or more messages in the queue is currently claimed.
/// </remarks>
/// <param name="queueName">The queue name.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that the task will observe.</param>
/// <returns>A <see cref="Task"/> object representing the asynchronous operation.</returns>
/// <exception cref="ArgumentNullException">If <paramref name="queueName"/> is <see langword="null"/>.</exception>
/// <exception cref="WebException">If the REST request does not return successfully.</exception>
/// <example>
/// <para>The following example demonstrates the use of this method using the <see cref="CloudQueuesProvider"/>
/// implementation of the <see cref="IQueueingService"/>. For more information about creating the provider, see
/// <see cref="CloudQueuesProvider.CloudQueuesProvider(CloudIdentity, string, Guid, bool, IIdentityProvider)"/>.</para>
/// <token>AsyncAwaitExample</token>
/// <code source="..\Samples\CSharpCodeSamples\QueueingServiceExamples.cs" region="DeleteQueueAsync (await)" language="cs"/>
/// <code source="..\Samples\VBCodeSamples\QueueingServiceExamples.vb" region="DeleteQueueAsync (await)" language="vbnet"/>
/// <code source="..\Samples\FSharpCodeSamples\QueueingServiceExamples.fs" region="DeleteQueueAsync (await)" language="fs"/>
/// <token>TplExample</token>
/// <code source="..\Samples\CSharpCodeSamples\QueueingServiceExamples.cs" region="DeleteQueueAsync (TPL)" language="cs"/>
/// <code source="..\Samples\VBCodeSamples\QueueingServiceExamples.vb" region="DeleteQueueAsync (TPL)" language="vbnet"/>
/// <code source="..\Samples\CPPCodeSamples\QueueingServiceExamples.cpp" region="DeleteQueueAsync (TPL)" language="cpp"/>
/// <code source="..\Samples\FSharpCodeSamples\QueueingServiceExamples.fs" region="DeleteQueueAsync (TPL)" language="fs"/>
/// </example>
/// <seealso href="https://wiki.openstack.org/w/index.php?title=Marconi/specs/api/v1#Delete_Queue">Delete Queue (OpenStack Marconi API v1 Blueprint)</seealso>
Task DeleteQueueAsync(QueueName queueName, CancellationToken cancellationToken);
#endregion
#region Queue metadata
/// <summary>
/// Sets the metadata associated with a queue.
/// </summary>
/// <typeparam name="T">The type of data to associate with the queue.</typeparam>
/// <param name="queueName">The queue name.</param>
/// <param name="metadata">The metadata to associate with the queue.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that the task will observe.</param>
/// <returns>A <see cref="Task"/> object representing the asynchronous operation.</returns>
/// <exception cref="ArgumentNullException">If <paramref name="queueName"/> is <see langword="null"/>.</exception>
/// <exception cref="WebException">If the REST request does not return successfully.</exception>
/// <seealso href="https://wiki.openstack.org/w/index.php?title=Marconi/specs/api/v1#Set_Queue_Metadata">Set Queue Metadata (OpenStack Marconi API v1 Blueprint)</seealso>
Task SetQueueMetadataAsync<T>(QueueName queueName, T metadata, CancellationToken cancellationToken)
where T : class;
/// <summary>
/// Gets the metadata associated with a queue.
/// </summary>
/// <param name="queueName">The queue name.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that the task will observe.</param>
/// <returns>A <see cref="Task"/> object representing the asynchronous operation. When the task completes successfully, the <see cref="Task{TResult}.Result"/> property will contain a <see cref="JObject"/> object containing the metadata associated with the queue.</returns>
/// <exception cref="ArgumentNullException">If <paramref name="queueName"/> is <see langword="null"/>.</exception>
/// <exception cref="WebException">If the REST request does not return successfully.</exception>
/// <seealso href="https://wiki.openstack.org/w/index.php?title=Marconi/specs/api/v1#Get_Queue_Metadata">Get Queue Metadata (OpenStack Marconi API v1 Blueprint)</seealso>
Task<JObject> GetQueueMetadataAsync(QueueName queueName, CancellationToken cancellationToken);
/// <summary>
/// Gets the metadata associated with a queue, as a strongly-typed object.
/// </summary>
/// <typeparam name="T">The type of metadata associated with the queue.</typeparam>
/// <param name="queueName">The queue name.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that the task will observe.</param>
/// <returns>A <see cref="Task"/> object representing the asynchronous operation. When the task completes successfully, the <see cref="Task{TResult}.Result"/> property will contain a deserialized object of type <typeparamref name="T"/> representing the metadata associated with the queue.</returns>
/// <exception cref="ArgumentNullException">If <paramref name="queueName"/> is <see langword="null"/>.</exception>
/// <exception cref="JsonSerializationException">If an error occurs while deserializing the metadata.</exception>
/// <exception cref="WebException">If the REST request does not return successfully.</exception>
/// <seealso href="https://wiki.openstack.org/w/index.php?title=Marconi/specs/api/v1#Get_Queue_Metadata">Get Queue Metadata (OpenStack Marconi API v1 Blueprint)</seealso>
Task<T> GetQueueMetadataAsync<T>(QueueName queueName, CancellationToken cancellationToken)
where T : class;
/// <summary>
/// Gets statistics for a queue.
/// </summary>
/// <param name="queueName">The queue name.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that the task will observe.</param>
/// <returns>A <see cref="Task"/> object representing the asynchronous operation. When the task completes successfully, the <see cref="Task{TResult}.Result"/> property will contain a <see cref="QueueStatistics"/> object containing statistics for the queue.</returns>
/// <exception cref="ArgumentNullException">If <paramref name="queueName"/> is <see langword="null"/>.</exception>
/// <exception cref="WebException">If the REST request does not return successfully.</exception>
/// <seealso href="https://wiki.openstack.org/w/index.php?title=Marconi/specs/api/v1#Get_Queue_Stats">Get Queue Stats (OpenStack Marconi API v1 Blueprint)</seealso>
Task<QueueStatistics> GetQueueStatisticsAsync(QueueName queueName, CancellationToken cancellationToken);
#endregion Queue metadata
#region Messages
/// <summary>
/// Gets a list of messages currently in a queue.
/// </summary>
/// <param name="queueName">The queue name.</param>
/// <param name="marker">The identifier of the message list page to return. This is obtained from <see cref="QueuedMessageList.NextPageId"/>. If this value is <see langword="null"/>, the list starts at the beginning.</param>
/// <param name="limit">The maximum number of messages to return. If this value is <see langword="null"/>, a provider-specific default value is used.</param>
/// <param name="echo"><see langword="true"/> to include messages created by the current client; otherwise, <see langword="false"/>.</param>
/// <param name="includeClaimed"><see langword="true"/> to include claimed messages; otherwise <see langword="false"/> to return only unclaimed messages.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that the task will observe.</param>
/// <returns>A <see cref="Task"/> object representing the asynchronous operation. When the task completes successfully, the <see cref="Task{TResult}.Result"/> property will contain a collection of <see cref="QueuedMessage"/> objects describing the messages in the queue.</returns>
/// <exception cref="ArgumentNullException">If <paramref name="queueName"/> is <see langword="null"/>.</exception>
/// <exception cref="ArgumentOutOfRangeException">If <paramref name="limit"/> is less than or equal to 0.</exception>
/// <exception cref="WebException">If the REST request does not return successfully.</exception>
/// <seealso href="https://wiki.openstack.org/w/index.php?title=Marconi/specs/api/v1#List_Messages">List Messages (OpenStack Marconi API v1 Blueprint)</seealso>
Task<QueuedMessageList> ListMessagesAsync(QueueName queueName, QueuedMessageListId marker, int? limit, bool echo, bool includeClaimed, CancellationToken cancellationToken);
/// <summary>
/// Gets detailed information about a specific queued message.
/// </summary>
/// <remarks>
/// This method will return information for the specified message regardless of the
/// <literal>Client-ID</literal> or claim associated with the message.
/// </remarks>
/// <param name="queueName">The queue name.</param>
/// <param name="messageId">The message ID. This is obtained from <see cref="QueuedMessage.Id">QueuedMessage.Id</see>.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that the task will observe.</param>
/// <returns>A <see cref="Task"/> object representing the asynchronous operation. When the task completes successfully, the <see cref="Task{TResult}.Result"/> property will contain a <see cref="QueuedMessage"/> object containing detailed information about the specified message.</returns>
/// <exception cref="ArgumentNullException">
/// If <paramref name="queueName"/> is <see langword="null"/>.
/// <para>-or-</para>
/// <para>If <paramref name="messageId"/> is <see langword="null"/>.</para>
/// </exception>
/// <exception cref="WebException">If the REST request does not return successfully.</exception>
/// <seealso href="https://wiki.openstack.org/w/index.php?title=Marconi/specs/api/v1#Get_a_Specific_Message">Get a Specific Message (OpenStack Marconi API v1 Blueprint)</seealso>
Task<QueuedMessage> GetMessageAsync(QueueName queueName, MessageId messageId, CancellationToken cancellationToken);
/// <summary>
/// Get messages from a queue.
/// </summary>
/// <remarks>
/// This method will return information for the specified message regardless of the
/// <literal>Client-ID</literal> or claim associated with the message.
/// </remarks>
/// <param name="queueName">The queue name.</param>
/// <param name="messageIds">The message IDs of messages to get.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that the task will observe.</param>
/// <returns>A <see cref="Task"/> object representing the asynchronous operation. When the task completes successfully, the <see cref="Task{TResult}.Result"/> property will contain a collection of <see cref="QueuedMessage"/> objects containing detailed information about the specified messages.</returns>
/// <exception cref="ArgumentNullException">
/// If <paramref name="queueName"/> is <see langword="null"/>.
/// <para>-or-</para>
/// <para>If <paramref name="messageIds"/> is <see langword="null"/>.</para>
/// </exception>
/// <exception cref="ArgumentException">
/// If <paramref name="messageIds"/> contains a <see langword="null"/> value.
/// </exception>
/// <exception cref="WebException">If the REST request does not return successfully.</exception>
/// <seealso href="https://wiki.openstack.org/w/index.php?title=Marconi/specs/api/v1#Get_a_Set_of_Messages_by_ID">Get a Set of Messages by ID (OpenStack Marconi API v1 Blueprint)</seealso>
Task<ReadOnlyCollection<QueuedMessage>> GetMessagesAsync(QueueName queueName, IEnumerable<MessageId> messageIds, CancellationToken cancellationToken);
/// <summary>
/// Posts messages to a queue.
/// </summary>
/// <remarks>
/// If <paramref name="messages"/> is empty, this call is equivalent to <see cref="QueueExistsAsync"/>,
/// and the <see cref="Task{TResult}.Result"/> property of the returned task contains
/// <see cref="MessagesEnqueued.Empty"/>.
/// </remarks>
/// <param name="queueName">The queue name.</param>
/// <param name="messages">The messages to post.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that the task will observe.</param>
/// <returns>
/// A <see cref="Task"/> object representing the asynchronous operation. When the task completes
/// successfully, the <see cref="Task{TResult}.Result"/> property will contain a
/// <see cref="MessagesEnqueued"/> object representing the result of the operation.
/// </returns>
/// <exception cref="ArgumentNullException">
/// If <paramref name="queueName"/> is <see langword="null"/>.
/// <para>-or-</para>
/// <para>If <paramref name="messages"/> is <see langword="null"/>.</para>
/// </exception>
/// <exception cref="ArgumentException">
/// If <paramref name="messages"/> contains a <see langword="null"/> value.
/// </exception>
/// <exception cref="WebException">If the REST request does not return successfully.</exception>
/// <seealso href="https://wiki.openstack.org/w/index.php?title=Marconi/specs/api/v1#Post_Message.28s.29">Post Message(s) (OpenStack Marconi API v1 Blueprint)</seealso>
Task<MessagesEnqueued> PostMessagesAsync(QueueName queueName, IEnumerable<Message> messages, CancellationToken cancellationToken);
/// <summary>
/// Posts messages to a queue.
/// </summary>
/// <remarks>
/// If <paramref name="messages"/> is empty, this call is equivalent to <see cref="QueueExistsAsync"/>,
/// and upon success the <see cref="Task{TResult}.Result"/> property of the returned task contains
/// <see cref="MessagesEnqueued.Empty"/>.
/// </remarks>
/// <param name="queueName">The queue name.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that the task will observe.</param>
/// <param name="messages">The messages to post.</param>
/// <returns>
/// A <see cref="Task"/> object representing the asynchronous operation. When the task completes
/// successfully, the <see cref="Task{TResult}.Result"/> property will contain a
/// <see cref="MessagesEnqueued"/> object representing the result of the operation.
/// </returns>
/// <exception cref="ArgumentNullException">
/// If <paramref name="queueName"/> is <see langword="null"/>.
/// <para>-or-</para>
/// <para>If <paramref name="messages"/> is <see langword="null"/>.</para>
/// </exception>
/// <exception cref="ArgumentException">
/// If <paramref name="messages"/> contains a <see langword="null"/> value.
/// </exception>
/// <exception cref="WebException">If the REST request does not return successfully.</exception>
/// <seealso href="https://wiki.openstack.org/w/index.php?title=Marconi/specs/api/v1#Post_Message.28s.29">Post Message(s) (OpenStack Marconi API v1 Blueprint)</seealso>
Task<MessagesEnqueued> PostMessagesAsync(QueueName queueName, CancellationToken cancellationToken, params Message[] messages);
/// <summary>
/// Posts messages to a queue.
/// </summary>
/// <remarks>
/// If <paramref name="messages"/> is empty, this call is equivalent to <see cref="QueueExistsAsync"/>,
/// and the <see cref="Task{TResult}.Result"/> property of the returned task contains
/// <see cref="MessagesEnqueued.Empty"/>.
/// </remarks>
/// <typeparam name="T">The class modeling the JSON representation of the messages to post in the queue.</typeparam>
/// <param name="queueName">The queue name.</param>
/// <param name="messages">The messages to post.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that the task will observe.</param>
/// <returns>
/// A <see cref="Task"/> object representing the asynchronous operation. When the task completes
/// successfully, the <see cref="Task{TResult}.Result"/> property will contain a
/// <see cref="MessagesEnqueued"/> object representing the result of the operation.
/// </returns>
/// <exception cref="ArgumentNullException">
/// If <paramref name="queueName"/> is <see langword="null"/>.
/// <para>-or-</para>
/// <para>If <paramref name="messages"/> is <see langword="null"/>.</para>
/// </exception>
/// <exception cref="ArgumentException">
/// If <paramref name="messages"/> contains a <see langword="null"/> value.
/// </exception>
/// <exception cref="WebException">If the REST request does not return successfully.</exception>
/// <seealso href="https://wiki.openstack.org/w/index.php?title=Marconi/specs/api/v1#Post_Message.28s.29">Post Message(s) (OpenStack Marconi API v1 Blueprint)</seealso>
Task<MessagesEnqueued> PostMessagesAsync<T>(QueueName queueName, IEnumerable<Message<T>> messages, CancellationToken cancellationToken);
/// <summary>
/// Posts messages to a queue.
/// </summary>
/// <remarks>
/// If <paramref name="messages"/> is empty, this call is equivalent to <see cref="QueueExistsAsync"/>,
/// and upon success the <see cref="Task{TResult}.Result"/> property of the returned task contains
/// <see cref="MessagesEnqueued.Empty"/>.
/// </remarks>
/// <typeparam name="T">The class modeling the JSON representation of the messages to post in the queue.</typeparam>
/// <param name="queueName">The queue name.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that the task will observe.</param>
/// <param name="messages">The messages to post.</param>
/// <returns>A <see cref="Task"/> object representing the asynchronous operation.</returns>
/// <exception cref="ArgumentNullException">
/// If <paramref name="queueName"/> is <see langword="null"/>.
/// <para>-or-</para>
/// <para>If <paramref name="messages"/> is <see langword="null"/>.</para>
/// </exception>
/// <exception cref="ArgumentException">
/// If <paramref name="messages"/> contains a <see langword="null"/> value.
/// </exception>
/// <exception cref="WebException">If the REST request does not return successfully.</exception>
/// <seealso href="https://wiki.openstack.org/w/index.php?title=Marconi/specs/api/v1#Post_Message.28s.29">Post Message(s) (OpenStack Marconi API v1 Blueprint)</seealso>
Task<MessagesEnqueued> PostMessagesAsync<T>(QueueName queueName, CancellationToken cancellationToken, params Message<T>[] messages);
/// <summary>
/// Deletes a message from a queue.
/// </summary>
/// <param name="queueName">The queue name.</param>
/// <param name="messageId">The ID of the message to delete. This is obtained from <see cref="QueuedMessage.Id">QueuedMessage.Id</see>.</param>
/// <param name="claim">The claim for the message. If this value is <see langword="null"/>, the delete operation will fail if the message is claimed. If this value is non-<see langword="null"/>, the delete operation will fail if the message is not claimed by the specified claim.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that the task will observe.</param>
/// <returns>A <see cref="Task"/> object representing the asynchronous operation.</returns>
/// <exception cref="ArgumentNullException">
/// If <paramref name="queueName"/> is <see langword="null"/>.
/// <para>-or-</para>
/// <para>If <paramref name="messageId"/> is <see langword="null"/>.</para>
/// </exception>
/// <exception cref="WebException">If the REST request does not return successfully.</exception>
/// <seealso href="https://wiki.openstack.org/w/index.php?title=Marconi/specs/api/v1#Delete_Message">Delete Message (OpenStack Marconi API v1 Blueprint)</seealso>
Task DeleteMessageAsync(QueueName queueName, MessageId messageId, Claim claim, CancellationToken cancellationToken);
/// <summary>
/// Deletes messages from a queue.
/// </summary>
/// <remarks>
/// <note type="warning">
/// This method deletes messages from a queue whether or not they are currently claimed.
/// </note>
/// </remarks>
/// <param name="queueName">The queue name.</param>
/// <param name="messageIds">The IDs of messages to delete. These are obtained from <see cref="QueuedMessage.Id">QueuedMessage.Id</see>.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that the task will observe.</param>
/// <returns>A <see cref="Task"/> object representing the asynchronous operation.</returns>
/// <exception cref="ArgumentNullException">
/// If <paramref name="queueName"/> is <see langword="null"/>.
/// <para>-or-</para>
/// <para>If <paramref name="messageIds"/> is <see langword="null"/>.</para>
/// </exception>
/// <exception cref="ArgumentException">
/// If <paramref name="messageIds"/> contains a <see langword="null"/> value.
/// </exception>
/// <exception cref="WebException">If the REST request does not return successfully.</exception>
/// <seealso href="https://wiki.openstack.org/w/index.php?title=Marconi/specs/api/v1#Delete_a_Set_of_Messages_by_ID">Delete a Set of Messages by ID (OpenStack Marconi API v1 Blueprint)</seealso>
Task DeleteMessagesAsync(QueueName queueName, IEnumerable<MessageId> messageIds, CancellationToken cancellationToken);
#endregion Messages
#region Claims
/// <summary>
/// Claim messages from a queue.
/// </summary>
/// <remarks>
/// <para>When the claim is no longer required, the code should call <see cref="Claim.DisposeAsync"/>
/// or <see cref="Claim.Dispose()"/> to ensure the following actions are taken.</para>
/// <list type="bullet">
/// <item>Messages which are part of this claim which were not processed are made available to other nodes.</item>
/// <item>The claim resource is cleaned up without waiting for the time-to-live to expire.</item>
/// </list>
///
/// <para>Messages which are not deleted before the claim is released will be eligible for
/// reclaiming by another process.</para>
/// </remarks>
/// <param name="queueName">The queue name.</param>
/// <param name="limit">The maximum number of messages to claim. If this value is <see langword="null"/>, a provider-specific default value is used.</param>
/// <param name="timeToLive">The time to wait before the server automatically releases the claim.</param>
/// <param name="gracePeriod">The time to wait, after the time-to-live for the claim expires, before the server allows the claimed messages to be deleted due to the individual message's time-to-live expiring.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that the task will observe.</param>
/// <returns>A <see cref="Task"/> object representing the asynchronous operation. When the task completes successfully, the <see cref="Task{TResult}.Result"/> property will contain <see cref="Claim"/> object representing the claim.</returns>
/// <exception cref="ArgumentNullException">If <paramref name="queueName"/> is <see langword="null"/>.</exception>
/// <exception cref="ArgumentOutOfRangeException">
/// If <paramref name="limit"/> is less than or equal to 0.
/// <para>-or-</para>
/// <para>If <paramref name="timeToLive"/> is negative or <see cref="TimeSpan.Zero"/>.</para>
/// <para>-or-</para>
/// <para>If <paramref name="gracePeriod"/> is negative.</para>
/// </exception>
/// <exception cref="WebException">If the REST request does not return successfully.</exception>
/// <seealso href="https://wiki.openstack.org/w/index.php?title=Marconi/specs/api/v1#Claim_Messages">Claim Messages (OpenStack Marconi API v1 Blueprint)</seealso>
Task<Claim> ClaimMessageAsync(QueueName queueName, int? limit, TimeSpan timeToLive, TimeSpan gracePeriod, CancellationToken cancellationToken);
/// <summary>
/// Gets detailed information about the current state of a claim.
/// </summary>
/// <remarks>
/// <note type="caller">Use <see cref="Claim.RefreshAsync"/> instead of calling this method directly.</note>
/// </remarks>
/// <param name="queueName">The queue name.</param>
/// <param name="claim">The claim to query.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that the task will observe.</param>
/// <returns>A <see cref="Task"/> object representing the asynchronous operation. When the task completes successfully, the <see cref="Task{TResult}.Result"/> property will contain a <see cref="Claim"/> object representing the claim.</returns>
/// <exception cref="ArgumentNullException">
/// If <paramref name="queueName"/> is <see langword="null"/>.
/// <para>-or-</para>
/// <para>If <paramref name="claim"/> is <see langword="null"/>.</para>
/// </exception>
/// <exception cref="WebException">If the REST request does not return successfully.</exception>
/// <seealso href="https://wiki.openstack.org/w/index.php?title=Marconi/specs/api/v1#Query_Claim">Query Claim (OpenStack Marconi API v1 Blueprint)</seealso>
[EditorBrowsable(EditorBrowsableState.Never)]
Task<Claim> QueryClaimAsync(QueueName queueName, Claim claim, CancellationToken cancellationToken);
/// <summary>
/// Renews a claim, by updating the time-to-live and resetting the age of the claim to zero.
/// </summary>
/// <remarks>
/// <note type="caller">Use <see cref="Claim.RenewAsync"/> instead of calling this method directly.</note>
/// </remarks>
/// <param name="queueName">The queue name.</param>
/// <param name="claim">The claim to renew.</param>
/// <param name="timeToLive">The updated time-to-live for the claim.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that the task will observe.</param>
/// <returns>A <see cref="Task"/> object representing the asynchronous operation.</returns>
/// <exception cref="ArgumentNullException">
/// If <paramref name="queueName"/> is <see langword="null"/>.
/// <para>-or-</para>
/// <para>If <paramref name="claim"/> is <see langword="null"/>.</para>
/// </exception>
/// <exception cref="ArgumentOutOfRangeException">If <paramref name="timeToLive"/> is negative.</exception>
/// <exception cref="WebException">If the REST request does not return successfully.</exception>
/// <seealso href="https://wiki.openstack.org/w/index.php?title=Marconi/specs/api/v1#Update_Claim">Update Claim (OpenStack Marconi API v1 Blueprint)</seealso>
[EditorBrowsable(EditorBrowsableState.Never)]
Task UpdateClaimAsync(QueueName queueName, Claim claim, TimeSpan timeToLive, CancellationToken cancellationToken);
/// <summary>
/// Immediately release a claim, making any (remaining, non-deleted) messages associated
/// with the claim available to other workers.
/// </summary>
/// <remarks>
/// <note type="caller">Use <see cref="Claim.DisposeAsync"/> instead of calling this method directly.</note>
/// </remarks>
/// <param name="queueName">The queue name.</param>
/// <param name="claim">The claim to release.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that the task will observe.</param>
/// <returns>A <see cref="Task"/> object representing the asynchronous operation.</returns>
/// <exception cref="ArgumentNullException">
/// If <paramref name="queueName"/> is <see langword="null"/>.
/// <para>-or-</para>
/// <para>If <paramref name="claim"/> is <see langword="null"/>.</para>
/// </exception>
/// <exception cref="WebException">If the REST request does not return successfully.</exception>
/// <seealso href="https://wiki.openstack.org/w/index.php?title=Marconi/specs/api/v1#Release_Claim">Release Claim (OpenStack Marconi API v1 Blueprint)</seealso>
[EditorBrowsable(EditorBrowsableState.Never)]
Task ReleaseClaimAsync(QueueName queueName, Claim claim, CancellationToken cancellationToken);
#endregion
}
}