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
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
|
<?php return [
'version' => '1.0',
'info' => ['product' => 'SMQProxy', 'version' => '2026-04-09'],
'directories' => [
[
'children' => ['PublishMessage'],
'type' => 'directory',
'title' => '主题',
'id' => 455559,
],
[
'children' => ['BatchDeleteMessage', 'BatchPeekMessage', 'BatchReceiveMessage', 'BatchSendMessage', 'ChangeMessageVisibility', 'DeleteMessage', 'PeekMessage', 'ReceiveMessage', 'SendMessage'],
'type' => 'directory',
'title' => '队列',
'id' => 455561,
],
],
'components' => [
'schemas' => [],
],
'apis' => [
'BatchDeleteMessage' => [
'path' => '/queues/{queueName}/messages',
'methods' => ['delete'],
'schemes' => ['https'],
'security' => [
[
'AK' => [],
],
],
'consumes' => ['application/json'],
'produces' => ['application/json'],
'operationType' => 'write',
'deprecated' => false,
'systemTags' => ['operationType' => 'delete', 'riskType' => 'none', 'chargeType' => 'paid'],
'parameters' => [
[
'name' => 'queueName',
'in' => 'path',
'schema' => ['description' => '队列名称。', 'type' => 'string', 'required' => false, 'example' => 'test-queue'],
],
[
'name' => 'body',
'in' => 'body',
'style' => 'json',
'schema' => [
'description' => '请求Body。',
'type' => 'object',
'properties' => [
'ReceiptHandles' => [
'description' => '多条消息的ReceiptHandle',
'type' => 'array',
'items' => ['description' => '消息的ReceiptHandle', 'type' => 'string', 'required' => false, 'example' => '1-ODU4OTkzNDU5My0xNDM'],
'required' => false,
],
],
'required' => false,
],
],
],
'responses' => [
204 => [
'schema' => [
'type' => 'object',
'properties' => [],
'description' => '',
],
],
],
'staticInfo' => ['returnType' => 'synchronous'],
'title' => '批量删除消息',
'summary' => '批量删除队列中的消息,最多可删除16条。',
'description' => '## 请求说明'."\n"
."\n"
.'- 建议与 BatchReceiveMessage 搭配使用。'."\n"
.'- 批量操作的结果可能同时包含成功和失败的子请求。只有全部成功时 HTTP 状态码才是 204。'."\n"
.'- 每次请求最多可以删除 16 条消息。'."\n"
.'- 需要提供上次消费返回的 `ReceiptHandle` 列表来定位要删除的消息。'."\n"
.'- 本操作只有在 `NextVisibleTime` 之前执行才能成功。超时后消息重新变为 Active 状态,ReceiptHandle 失效,需重新消费获取新句柄。'."\n",
'changeSet' => [],
'responseDemo' => '[{"errorExample":"","example":"{}","type":"json"}]',
],
'BatchPeekMessage' => [
'summary' => '批量查看队列中的消息,不改变消息状态。',
'path' => '/queues/{queueName}/messages',
'methods' => ['get'],
'schemes' => ['https'],
'security' => [
[
'AK' => [],
],
],
'consumes' => ['application/json'],
'produces' => ['application/json'],
'operationType' => 'read',
'deprecated' => false,
'systemTags' => ['operationType' => 'get', 'riskType' => 'none', 'chargeType' => 'paid'],
'parameters' => [
[
'name' => 'queueName',
'in' => 'path',
'schema' => ['description' => '队列名称。', 'type' => 'string', 'required' => false, 'example' => 'test-queue'],
],
[
'name' => 'peekonly',
'in' => 'query',
'schema' => ['title' => '表示这次请求只是去查看队列顶部的消息并不会引起消息的状态改变。取值固定为true。', 'description' => '表示这次请求只是去查看队列顶部的消息并不会引起消息的状态改变。取值固定为true。', 'type' => 'boolean', 'required' => false, 'default' => 'true'],
],
[
'name' => 'numOfMessages',
'in' => 'query',
'schema' => ['title' => '本次BatchPeekMessage最多查看消息条数。', 'description' => '本次BatchPeekMessage最多查看消息条数。', 'type' => 'integer', 'format' => 'int32', 'required' => false, 'example' => '16'],
],
],
'responses' => [
200 => [
'schema' => [
'title' => 'Schema of Response',
'description' => 'Schema of Response',
'type' => 'object',
'properties' => [
'Messages' => [
'description' => '消息列表',
'type' => 'array',
'items' => [
'type' => 'object',
'properties' => [
'MessageId' => ['description' => '消息ID。', 'type' => 'string', 'example' => 'C0A80255D7D1163042EA3F2814D055F1'],
'MessageBody' => ['description' => '消息体', 'type' => 'string', 'example' => 'This is a test message'],
'MessageBodyMD5' => ['description' => '消息正文的MD5值', 'type' => 'string', 'example' => 'F9360F391579E71CA77BC5D50242****'],
'EnqueueTime' => ['description' => '消息发送到队列的时间,取值为从1970年01月01日00:00:00 000开始的时间。', 'type' => 'integer', 'format' => 'int64', 'example' => '1250700979248'],
'FirstDequeueTime' => ['description' => '消息第一次被消费的时间,取值为从1970年01月01日00:00:00 000开始的毫秒数,如果DequeueCount为0,则与消息的EnqueueTime相同。', 'type' => 'integer', 'format' => 'int64', 'example' => '1250700979348'],
'DequeueCount' => ['description' => '总共被消费的次数。', 'type' => 'integer', 'format' => 'int64', 'example' => '5'],
'Priority' => ['description' => '优先级,取值[1, 16],默认 8,1为 最高优先', 'type' => 'integer', 'format' => 'int64', 'example' => '1'],
'MessageGroupId' => ['description' => '消息分组 ID(仅 FIFO 队列)。', 'type' => 'string', 'example' => 'test-group'],
'UserProperties' => [
'description' => '用户自定义属性(JSON 格式字符串)。',
'type' => 'object',
'example' => '{"properties1":"value"}',
'additionalProperties' => [
'type' => 'object',
'properties' => [
'DataType' => ['type' => 'string'],
'StringValue' => ['type' => 'string'],
'BinaryValue' => ['type' => 'string'],
],
],
],
],
'description' => '',
],
],
],
],
],
],
'staticInfo' => ['returnType' => 'synchronous'],
'title' => '批量查看消息',
'description' => '## 请求说明'."\n"
.'- 该接口用于批量查看指定队列中的消息,一次最多可以查看16条消息。'."\n"
.'- 使用此接口不会改变消息的状态,消息仍保持为Active状态。'."\n"
.'- 不支持长轮询功能。'."\n"
.'- 需要提供`queueName`作为路径参数,并通过查询参数设置`peekonly=true`及指定要查看的消息数量`numOfMessages`(范围在1到16之间)。'."\n"
.'- 成功响应将返回一个包含所请求消息详细信息的数组,包括但不限于消息ID、正文、入队时间等。'."\n"
.'- 如果指定的队列不存在或队列中没有可见消息,则会返回相应的错误码。'."\n",
'changeSet' => [],
'responseDemo' => '[{"errorExample":"","example":"{\\n \\"Messages\\": [\\n {\\n \\"MessageId\\": \\"C0A80255D7D1163042EA3F2814D055F1\\",\\n \\"MessageBody\\": \\"This is a test message\\",\\n \\"MessageBodyMD5\\": \\"F9360F391579E71CA77BC5D50242****\\",\\n \\"EnqueueTime\\": 1250700979248,\\n \\"FirstDequeueTime\\": 1250700979348,\\n \\"DequeueCount\\": 5,\\n \\"Priority\\": 1,\\n \\"MessageGroupId\\": \\"test-group\\",\\n \\"UserProperties\\": {\\n \\"key\\": {\\n \\"DataType\\": \\"\\",\\n \\"StringValue\\": \\"\\",\\n \\"BinaryValue\\": \\"\\"\\n }\\n }\\n }\\n ]\\n}","type":"json"}]',
],
'BatchReceiveMessage' => [
'summary' => '从指定队列中批量获取最多16条消息进行消费。',
'path' => '/queues/{queueName}/messages',
'methods' => ['get'],
'schemes' => ['https'],
'security' => [
[
'AK' => [],
],
],
'consumes' => ['application/json'],
'produces' => ['application/json'],
'operationType' => 'read',
'deprecated' => false,
'systemTags' => ['operationType' => 'get', 'riskType' => 'none', 'chargeType' => 'paid'],
'parameters' => [
[
'name' => 'queueName',
'in' => 'path',
'schema' => ['description' => '队列名称'."\n", 'type' => 'string', 'required' => false, 'example' => 'MyQueue'],
],
[
'name' => 'numOfMessages',
'in' => 'query',
'schema' => ['title' => '本次BatchReceiveMessage最多获取的消息条数。', 'description' => '本次最多获取的消息条数。'."\n", 'type' => 'integer', 'format' => 'int32', 'required' => false, 'example' => '10'],
],
[
'name' => 'waitseconds',
'in' => 'query',
'schema' => ['title' => '本次BatchReceiveMessage请求最长的Polling等待时间,单位为秒。', 'description' => '本次请求最长的 Polling 等待时间(秒)。设为 0 表示立即返回。'."\n", 'type' => 'integer', 'format' => 'int32', 'required' => false, 'example' => '0'],
],
],
'responses' => [
200 => [
'schema' => [
'title' => 'Schema of Response',
'description' => '返回的消息列表'."\n",
'type' => 'object',
'properties' => [
'Messages' => [
'description' => '消息数组'."\n",
'type' => 'array',
'items' => [
'type' => 'object',
'properties' => [
'MessageId' => ['description' => '消息编号,在一个队列中唯一。'."\n", 'type' => 'string', 'example' => '5F290C926D472878214D9529A8FA200000001'],
'ReceiptHandle' => ['description' => '本次获取消息产生的临时句柄,用于删除和修改 Inactive 状态消息,NextVisibleTime 之前有效。'."\n", 'type' => 'string', 'example' => '1-ODU4OTkzNDU5My0xNDMyNzI3ODI3LTItOA=='],
'MessageBody' => ['description' => '消息正文。'."\n", 'type' => 'string', 'example' => 'This is test message 1.'],
'MessageBodyMD5' => ['description' => '消息正文的 MD5 值。'."\n", 'type' => 'string', 'example' => 'C5DD56A39F5F7BB8B3337C6D11B6D8BE'],
'EnqueueTime' => ['description' => '消息发送到队列的时间,从1970-01-01 00:00:00 000开始的毫秒数。'."\n", 'type' => 'integer', 'format' => 'int64', 'example' => '1250700979348'],
'NextVisibleTime' => ['description' => '下次可被再次消费的时间(毫秒时间戳)。'."\n", 'type' => 'integer', 'format' => 'int64', 'example' => '1250700979348'],
'FirstDequeueTime' => ['description' => '首次被消费的时间(毫秒时间戳)。若 `DequeueCount=0` 则与 `EnqueueTime` 相同。'."\n", 'type' => 'integer', 'format' => 'int64', 'example' => '1250700979348'],
'DequeueCount' => ['description' => '总共被消费的次数。'."\n", 'type' => 'integer', 'format' => 'int64', 'example' => '1'],
'Priority' => ['description' => '优先级,1 最高', 'type' => 'integer', 'format' => 'int64', 'example' => '1'],
'MessageGroupId' => ['description' => '消息分组 ID(仅 FIFO 队列)。', 'type' => 'string', 'example' => 'test-group'],
'UserProperties' => [
'description' => '用户自定义属性(JSON 格式字符串)。',
'type' => 'object',
'example' => '{"properties1":"value"}',
'additionalProperties' => [
'type' => 'object',
'properties' => [
'DataType' => ['type' => 'string'],
'StringValue' => ['type' => 'string'],
'BinaryValue' => ['type' => 'string'],
],
],
],
],
'description' => '',
],
],
],
],
],
],
'staticInfo' => ['returnType' => 'synchronous'],
'title' => '批量消费消息',
'description' => '## 请求说明'."\n"
."\n"
.'- 该操作会将取得的消息状态变为 Inactive,Inactive 持续时间由队列属性 `VisibilityTimeout` 决定。'."\n"
.'- 消费者需在 VisibilityTimeout 时间内调用 DeleteMessage 删除消息,否则消息会重新变为 Active。'."\n"
.'- 支持长轮询(Long Polling):设置 `waitseconds > 0` 后,若队列为空则等待至有消息到达或超时返回。'."\n"
.'><notice>进入长轮询后,建议您降低外部调用长轮询的并发数,选择合适的长轮询时间。目前服务端会根据长轮询数量、长轮询等待时间、访问 IP 数量等因素动态调整长轮询防攻击的并发上限值。当队列无消息时,超过长轮询上限值的请求将无法被监听到,并直接返回 404 MessageNotExist(按请求量正常计费)。如果您有临时提升长轮询上限值的需求,请及时提交工单。></notice>',
'changeSet' => [],
'responseDemo' => '[{"errorExample":"","example":"{\\n \\"Messages\\": [\\n {\\n \\"MessageId\\": \\"5F290C926D472878214D9529A8FA200000001\\",\\n \\"ReceiptHandle\\": \\"1-ODU4OTkzNDU5My0xNDMyNzI3ODI3LTItOA==\\",\\n \\"MessageBody\\": \\"This is test message 1.\\",\\n \\"MessageBodyMD5\\": \\"C5DD56A39F5F7BB8B3337C6D11B6D8BE\\",\\n \\"EnqueueTime\\": 1250700979348,\\n \\"NextVisibleTime\\": 1250700979348,\\n \\"FirstDequeueTime\\": 1250700979348,\\n \\"DequeueCount\\": 1,\\n \\"Priority\\": 1,\\n \\"MessageGroupId\\": \\"test-group\\",\\n \\"UserProperties\\": {\\n \\"key\\": {\\n \\"DataType\\": \\"\\",\\n \\"StringValue\\": \\"\\",\\n \\"BinaryValue\\": \\"\\"\\n }\\n }\\n }\\n ]\\n}","type":"json"}]',
],
'BatchSendMessage' => [
'summary' => '向指定队列批量发送最多16条消息,总大小不超过64KB。',
'path' => '/queues/{queueName}/messages',
'methods' => ['post'],
'schemes' => ['https'],
'security' => [
[
'AK' => [],
],
],
'consumes' => ['application/json'],
'produces' => ['application/json'],
'operationType' => 'write',
'deprecated' => false,
'systemTags' => ['operationType' => 'create', 'riskType' => 'none', 'chargeType' => 'paid'],
'parameters' => [
[
'name' => 'queueName',
'in' => 'path',
'schema' => ['description' => '队列名称'."\n", 'type' => 'string', 'required' => false, 'example' => 'MyQueue'],
],
[
'name' => 'body',
'in' => 'body',
'style' => 'json',
'schema' => [
'description' => '消息列表'."\n",
'type' => 'object',
'properties' => [
'Messages' => [
'description' => '消息列表'."\n",
'type' => 'array',
'items' => [
'type' => 'object',
'properties' => [
'MessageBody' => ['description' => '消息正文'."\n", 'type' => 'string', 'required' => false, 'example' => 'This is test message 1.'],
'DelaySeconds' => ['description' => '延迟可消费时间(秒)'."\n", 'type' => 'integer', 'format' => 'int32', 'required' => false, 'example' => '60'],
'Priority' => ['description' => '优先级。数值越小优先级越高,1 为最高优先级。'."\n", 'type' => 'integer', 'format' => 'int32', 'required' => false, 'example' => '1'],
'MessageGroupId' => ['description' => '消息分组 ID,同一分组内的消息保证顺序投递。仅 FIFO 队列有效。'."\n", 'type' => 'string', 'required' => false, 'example' => 'group1'],
'UserProperties' => [
'type' => 'object',
'additionalProperties' => [
'type' => 'object',
'properties' => [
'DataType' => ['type' => 'string'],
'StringValue' => ['type' => 'string'],
'BinaryValue' => ['type' => 'string'],
],
],
],
],
'required' => false,
'description' => '',
],
'required' => false,
],
],
'required' => false,
'example' => '{'."\n"
.' "Messages": ['."\n"
.' {'."\n"
.' "MessageBody": "...",'."\n"
.' "DelaySeconds": 60,'."\n"
.' "Priority": 1'."\n"
.' }'."\n"
.' ]'."\n"
.'}',
],
],
],
'responses' => [
200 => [
'schema' => [
'type' => 'object',
'properties' => [
'Messages' => [
'type' => 'array',
'items' => [
'type' => 'object',
'properties' => [
'MessageId' => ['type' => 'string'],
'MessageBodyMD5' => ['type' => 'string'],
],
],
],
],
],
],
],
'staticInfo' => ['returnType' => 'synchronous'],
'title' => '批量发送消息',
'description' => '## 请求说明'."\n"
.'- 一次 Batch 请求的消息总大小不得超过 64 KB。'."\n"
.'- `BatchSendMessage` 与 `SendMessage` 使用相同的 URL 路径,通过 Body 结构区分:包含 `Messages` 数组即为批量发送,否则为单条发送。'."\n"
.'- 批量操作的返回结果可能同时包含成功和失败的子消息。'."\n"
.'- 每次请求中可以包含多个消息对象,每个消息对象可以设置不同的延迟时间和优先级。'."\n"
.'- 对于 FIFO 队列,可以通过 `MessageGroupId` 参数来指定消息分组 ID。'."\n",
'changeSet' => [],
'responseDemo' => '[{"errorExample":"","example":"{\\n \\"Messages\\": [\\n {\\n \\"MessageId\\": \\"\\",\\n \\"MessageBodyMD5\\": \\"\\"\\n }\\n ]\\n}","type":"json"}]',
],
'ChangeMessageVisibility' => [
'summary' => '用于延长或缩短处于 Inactive 状态的消息的不可见时间。',
'path' => '/queues/{queueName}/messages',
'methods' => ['put'],
'schemes' => ['https'],
'security' => [
[
'AK' => [],
],
],
'consumes' => ['application/json'],
'produces' => ['application/json'],
'operationType' => 'write',
'deprecated' => false,
'systemTags' => ['operationType' => 'update', 'riskType' => 'none', 'chargeType' => 'paid'],
'parameters' => [
[
'name' => 'queueName',
'in' => 'path',
'schema' => ['description' => '队列名称'."\n", 'type' => 'string', 'required' => false, 'example' => 'MyQueue'],
],
[
'name' => 'receiptHandle',
'in' => 'query',
'schema' => ['title' => '上次消费后返回的消息的ReceiptHandle。', 'description' => '上次消费后返回的消息临时句柄。'."\n", 'type' => 'string', 'required' => false, 'example' => '1-ODU4OTkzNDU5My0xNDMyNzI3ODI3LTItOA=='],
],
[
'name' => 'visibilityTimeout',
'in' => 'query',
'schema' => ['title' => '将消息的可见性超时时间设置为当前入参值,单位:秒。取值范围[1, 43200]秒。', 'description' => '从当前时刻开始,消息重新变为 Active 的倒计时。[1, 43200](秒),即 1 秒 ~ 12 小时', 'type' => 'integer', 'format' => 'int32', 'required' => false, 'example' => '50'],
],
],
'responses' => [
200 => [
'schema' => [
'title' => 'Schema of Response',
'description' => '返回参数包括新的临时句柄和下次可被再次消费的时间(毫秒时间戳)。'."\n",
'type' => 'object',
'properties' => [
'ReceiptHandle' => ['description' => '新的临时句柄(后续删除/修改操作必须使用此新句柄),NextVisibleTime 之前有效。'."\n", 'type' => 'string', 'example' => 'TbZj6wDWli+9CEauMZc8ZRv37sIW2iJKq3M9Mx/TS1'],
'NextVisibleTime' => ['description' => '下次可被再次消费的时间(毫秒时间戳)。'."\n", 'type' => 'integer', 'format' => 'int64', 'example' => '1250700979348'],
],
],
],
],
'staticInfo' => ['returnType' => 'synchronous'],
'title' => '修改消息可见性超时时间',
'description' => '## 请求说明'."\n"
."\n"
.'- 该接口允许用户修改已经被消费且当前处于 Inactive 状态的消息的 VisibilityTimeout,即从当前时刻开始到消息重新变为 Active 的倒计时。'."\n"
.'- 调用成功后会返回新的 `ReceiptHandle`,后续删除或再次修改此消息的可见性超时时间时必须使用新句柄。'."\n"
.'- 只能在 `NextVisibleTime` 之前调用成功,否则将收到错误提示。'."\n"
.'- 典型应用场景包括消费者处理耗时较长的情况,需要延长 VisibilityTimeout 以避免消息被重复消费。'."\n",
'changeSet' => [],
'responseDemo' => '[{"errorExample":"","example":"{\\n \\"ReceiptHandle\\": \\"TbZj6wDWli+9CEauMZc8ZRv37sIW2iJKq3M9Mx/TS1\\",\\n \\"NextVisibleTime\\": 1250700979348\\n}","type":"json"}]',
],
'DeleteMessage' => [
'path' => '/queues/{queueName}/messages',
'methods' => ['delete'],
'schemes' => ['https'],
'security' => [
[
'AK' => [],
],
],
'consumes' => ['application/json'],
'produces' => ['application/json'],
'operationType' => 'write',
'deprecated' => false,
'systemTags' => ['operationType' => 'delete', 'riskType' => 'none', 'chargeType' => 'paid'],
'parameters' => [
[
'name' => 'queueName',
'in' => 'path',
'schema' => ['description' => '队列名称'."\n", 'type' => 'string', 'required' => false, 'example' => 'MyQueue'],
],
[
'name' => 'ReceiptHandle',
'in' => 'query',
'schema' => ['title' => '上次消费后返回的消息的ReceiptHandle。', 'description' => '上次消费后返回的消息临时句柄。'."\n", 'type' => 'string', 'required' => false, 'example' => '1-ODU4OTkzNDU5My0xNDM1MTk3NjAwLTItNg=='],
],
],
'responses' => [
204 => [
'schema' => [
'type' => 'object',
'properties' => [],
'description' => '',
],
],
],
'staticInfo' => ['returnType' => 'synchronous'],
'title' => '删除已消费消息',
'summary' => '通过提供的ReceiptHandle删除已经被消费的消息。',
'description' => '## 请求说明'."\n"
.'- 消费者需将上次消费返回的 `ReceiptHandle` 作为参数来定位要删除的消息。'."\n"
.'- 本操作只有在 `NextVisibleTime` 之前执行才能成功。超时后消息重新变为 Active 状态,ReceiptHandle 失效,需重新消费获取新句柄。'."\n",
'changeSet' => [],
'responseDemo' => '[{"errorExample":"","example":"{}","type":"json"}]',
],
'PeekMessage' => [
'path' => '/queues/{queueName}/messages',
'methods' => ['get'],
'schemes' => ['https'],
'security' => [
[
'AK' => [],
],
],
'consumes' => ['application/json'],
'produces' => ['application/json'],
'operationType' => 'read',
'deprecated' => false,
'systemTags' => ['operationType' => 'get', 'riskType' => 'none', 'chargeType' => 'paid'],
'parameters' => [
[
'name' => 'queueName',
'in' => 'path',
'schema' => ['description' => '队列名称'."\n", 'type' => 'string', 'required' => false, 'example' => 'MyQueue'],
],
[
'name' => 'peekonly',
'in' => 'query',
'schema' => ['title' => '表示这次请求只是去查看队列顶部的消息并不会引起消息的状态改变。取值固定为true。', 'description' => '表示这次请求只是去查看队列顶部的消息并不会引起消息的状态改变。取值固定为true。', 'type' => 'boolean', 'required' => false, 'default' => 'true'],
],
],
'responses' => [
200 => [
'schema' => [
'title' => 'Schema of Response',
'description' => '- **MessageId**: 消息编号,在一个队列中唯一。'."\n"
.'- **ReceiptHandle**: 本次获取消息产生的临时句柄,用于删除和修改 Inactive 状态消息,NextVisibleTime 之前有效。'."\n"
.'- **MessageBody**: 消息正文。'."\n"
.'- **MessageBodyMD5**: 消息正文的 MD5 值。'."\n"
.'- **EnqueueTime**: 消息发送到队列的时间,从1970-01-01 00:00:00 000开始的毫秒数。'."\n",
'type' => 'object',
'properties' => [
'MessageId' => ['description' => '消息编号,在一个队列中唯一。'."\n", 'type' => 'string', 'example' => '5F290C926D472878-2-14D9529A8FA-200000001'],
'MessageBody' => ['description' => '消息正文。'."\n", 'type' => 'string', 'example' => 'Hello MNS'],
'MessageBodyMD5' => ['description' => '消息正文的 MD5 值。'."\n", 'type' => 'string', 'example' => 'C5DD56A39F5F7BB8B3337C6D11B6D8BE'],
'EnqueueTime' => ['description' => '消息发送到队列的时间,从1970-01-01 00:00:00 000开始的毫秒数。'."\n", 'type' => 'integer', 'format' => 'int64', 'example' => '1250700979348'],
'FirstDequeueTime' => ['description' => '第一次被消费的时间(毫秒时间戳)。'."\n", 'type' => 'integer', 'format' => 'int64', 'example' => '1250700979348'],
'DequeueCount' => ['description' => '总共被消费的次数。'."\n", 'type' => 'integer', 'format' => 'int64', 'example' => '1'],
'Priority' => ['description' => '优先级,1 最高', 'type' => 'integer', 'format' => 'int64', 'example' => '1'],
'MessageGroupId' => ['description' => '消息分组 ID(仅 FIFO 队列)。', 'type' => 'string', 'example' => 'test-group'],
'UserProperties' => [
'description' => '用户自定义属性',
'type' => 'object',
'example' => '{"xxx":"value"}',
'additionalProperties' => [
'type' => 'object',
'properties' => [
'DataType' => ['type' => 'string'],
'StringValue' => ['type' => 'string'],
'BinaryValue' => ['type' => 'string'],
],
],
],
],
],
],
],
'staticInfo' => ['returnType' => 'synchronous'],
'title' => '查看队列消息',
'summary' => '查看队列顶部的消息而不改变消息状态。',
'description' => '## 请求说明'."\n"
.'- **PeekMessage** 接口用于查看队列顶部的消息,但不会改变消息的状态,消息仍处于 Active 状态可被正常消费。'."\n"
.'- 该接口不支持长轮询,如果队列为空则立即返回 `MessageNotExist` 错误。'."\n"
.'- 请求时必须设置 `peekonly=true` 参数以表明仅查看消息。'."\n",
'changeSet' => [],
'responseDemo' => '[{"errorExample":"","example":"{\\n \\"MessageId\\": \\"5F290C926D472878-2-14D9529A8FA-200000001\\",\\n \\"MessageBody\\": \\"Hello MNS\\",\\n \\"MessageBodyMD5\\": \\"C5DD56A39F5F7BB8B3337C6D11B6D8BE\\",\\n \\"EnqueueTime\\": 1250700979348,\\n \\"FirstDequeueTime\\": 1250700979348,\\n \\"DequeueCount\\": 1,\\n \\"Priority\\": 1,\\n \\"MessageGroupId\\": \\"test-group\\",\\n \\"UserProperties\\": {\\n \\"key\\": {\\n \\"DataType\\": \\"\\",\\n \\"StringValue\\": \\"\\",\\n \\"BinaryValue\\": \\"\\"\\n }\\n }\\n}","type":"json"}]',
],
'PublishMessage' => [
'summary' => '向指定的主题发布消息,消息将被推送给所有订阅的Endpoint。',
'path' => '/topics/{topicName}/messages',
'methods' => ['post'],
'schemes' => ['https'],
'security' => [
[
'AK' => [],
],
],
'consumes' => ['application/json'],
'produces' => ['application/json'],
'operationType' => 'write',
'deprecated' => false,
'systemTags' => ['operationType' => 'create', 'riskType' => 'none', 'chargeType' => 'paid'],
'parameters' => [
[
'name' => 'topicName',
'in' => 'path',
'schema' => ['description' => '**主题名称**'."\n", 'type' => 'string', 'required' => false, 'example' => 'MyTopic'],
],
[
'name' => 'body',
'in' => 'body',
'style' => 'json',
'schema' => [
'description' => '**消息内容**。建议事先 Base64 编码。'."\n",
'type' => 'object',
'properties' => [
'MessageBody' => ['description' => '**消息内容**。建议事先 Base64 编码。'."\n"
.'最大 64 KB', 'type' => 'string', 'required' => false, 'example' => 'hello topic'],
'MessageTag' => ['description' => '**消息标签**,用于订阅的消息过滤。'."\n"
.'最大 64 字符', 'type' => 'string', 'required' => false, 'example' => 'order-event'],
'MessageGroupId' => ['type' => 'string'],
'MessageAttributes' => [
'description' => '**消息属性**。推送到 Queue/HTTP 时不需设置。'."\n",
'type' => 'object',
'properties' => [
'DirectMail' => ['description' => '**邮件推送属性**(JSON 格式字符串)。'."\n", 'type' => 'string', 'required' => false, 'example' => '详见 https://help.aliyun.com/zh/direct-mail/singlesendmail'],
'DirectSMS' => ['description' => '短信推送属性(JSON 格式字符串),包含 `FreeSignName`、`TemplateCode`、`Type`、`Receiver`、`SmsParams`。'."\n", 'type' => 'string', 'required' => false, 'example' => '{"FreeSignName":"阿里云","TemplateCode":"SMS_123456","Type":"singleContent","Receiver":"13800000000","SmsParams":"{\\"code\\":\\"1234\\"}"}'],
'Push' => ['description' => '移动推送属性(JSON 格式字符串)。'."\n", 'type' => 'string', 'required' => false, 'example' => '移动推送属性示例值'],
],
'required' => false,
],
],
'required' => false,
],
],
],
'responses' => [
200 => [
'schema' => [
'type' => 'object',
'properties' => [
'MessageId' => ['type' => 'string'],
'MessageBodyMD5' => ['type' => 'string'],
],
],
],
],
'staticInfo' => ['returnType' => 'synchronous'],
'title' => '发布主题消息',
'description' => '## 请求说明'."\n"
."\n"
.'- 消息发布后会被推送到该 Topic 下所有 Subscription 的 Endpoint。'."\n"
.'- 推送到 Queue 和 HTTP Endpoint 时不需要设置 `MessageAttributes`。'."\n"
.'- 推送到邮件、短信或移动推送时需要设置对应的 `MessageAttributes` 子属性。'."\n"
.'- 消息内容建议事先进行 Base64 编码以避免特殊字符问题。'."\n",
'changeSet' => [],
'responseDemo' => '[{"errorExample":"","example":"{\\n \\"MessageId\\": \\"\\",\\n \\"MessageBodyMD5\\": \\"\\"\\n}","type":"json"}]',
],
'ReceiveMessage' => [
'summary' => '从指定队列中获取并锁定一条消息,用于处理。',
'path' => '/queues/{queueName}/messages',
'methods' => ['get'],
'schemes' => ['https'],
'security' => [
[
'AK' => [],
],
],
'consumes' => ['application/json'],
'produces' => ['application/json'],
'operationType' => 'read',
'deprecated' => false,
'systemTags' => ['operationType' => 'get', 'riskType' => 'none', 'chargeType' => 'paid'],
'parameters' => [
[
'name' => 'queueName',
'in' => 'path',
'schema' => ['description' => '**队列名称**'."\n", 'type' => 'string', 'required' => false, 'example' => 'MyQueue'],
],
[
'name' => 'waitseconds',
'in' => 'query',
'schema' => ['title' => '本次ReceiveMessage请求最长的Polling等待时间,单位为秒。', 'description' => '**本次请求最长的 Polling 等待时间(秒)**。设为 0 表示立即返回。'."\n", 'type' => 'integer', 'format' => 'int32', 'required' => false, 'example' => '0'],
],
],
'responses' => [
200 => [
'schema' => [
'title' => 'Schema of Response',
'description' => 'Schema of Response',
'type' => 'object',
'properties' => [
'MessageId' => ['description' => '**消息编号**,在一个队列中唯一。'."\n", 'type' => 'string', 'example' => '5F290C926D472878-2-14D9529A8FA-200000001'],
'ReceiptHandle' => ['description' => '**本次获取消息产生的临时句柄**,用于删除和修改 Inactive 状态消息,NextVisibleTime 之前有效。'."\n", 'type' => 'string', 'example' => '1-ODU4OTkzNDU5My0xNDM1MTk3NjAwLTItNg=='],
'MessageBody' => ['description' => '**消息正文**。'."\n", 'type' => 'string', 'example' => 'Hello MNS'],
'MessageBodyMD5' => ['description' => '消息正文的 MD5 值。'."\n", 'type' => 'string', 'example' => 'C5DD56A39F5F7BB8B3337C6D11B6D8BE'],
'EnqueueTime' => ['description' => '消息发送到队列的时间,从1970-01-01 00:00:00 000开始的毫秒数。'."\n", 'type' => 'integer', 'format' => 'int64', 'example' => '1250700979348'],
'NextVisibleTime' => ['description' => '下次可被再次消费的时间(毫秒时间戳)。'."\n", 'type' => 'integer', 'format' => 'int64', 'example' => '1250700979348'],
'FirstDequeueTime' => ['description' => '第一次被消费的时间(毫秒时间戳)。若 DequeueCount=0 则与 EnqueueTime 相同。'."\n", 'type' => 'integer', 'format' => 'int64', 'example' => '1250700979348'],
'DequeueCount' => ['description' => '总共被消费的次数。'."\n", 'type' => 'integer', 'format' => 'int64', 'example' => '1'],
'Priority' => ['description' => '优先级,1 最高', 'type' => 'integer', 'format' => 'int64', 'example' => '1'],
'MessageGroupId' => ['description' => '消息分组 ID(仅 FIFO 队列)。', 'type' => 'string', 'example' => 'test-group'],
'UserProperties' => [
'description' => '用户自定义属性',
'type' => 'object',
'example' => '{"xxx":"value"}',
'additionalProperties' => [
'type' => 'object',
'properties' => [
'DataType' => ['type' => 'string'],
'StringValue' => ['type' => 'string'],
'BinaryValue' => ['type' => 'string'],
],
],
],
],
],
],
],
'staticInfo' => ['returnType' => 'synchronous'],
'title' => '消费消息',
'description' => '## 请求说明'."\n"
."\n"
.'- `ReceiveMessage` 操作会将取得的消息状态变为 Inactive,Inactive 持续时间由队列属性 `VisibilityTimeout` 决定。'."\n"
.'- 消费者需在 VisibilityTimeout 时间内消费成功后调用 `DeleteMessage` 删除该消息,否则消息将重新变为 Active 状态,被再次消费。'."\n"
.'- 支持长轮询(Long Polling):设置 `waitseconds > 0` 后,若队列为空则等待至有消息到达或超时返回。'."\n"
.'><notice>进入长轮询后,建议您降低外部调用长轮询的并发数,选择合适的长轮询时间。目前服务端会根据长轮询数量、长轮询等待时间、访问 IP 数量等因素动态调整长轮询防攻击的并发上限值。当队列无消息时,超过长轮询上限值的请求将无法被监听到,并直接返回 404 MessageNotExist(按请求量正常计费)。如果您有临时提升长轮询上限值的需求,请及时提交工单。></notice>',
'changeSet' => [],
'responseDemo' => '[{"errorExample":"","example":"{\\n \\"MessageId\\": \\"5F290C926D472878-2-14D9529A8FA-200000001\\",\\n \\"ReceiptHandle\\": \\"1-ODU4OTkzNDU5My0xNDM1MTk3NjAwLTItNg==\\",\\n \\"MessageBody\\": \\"Hello MNS\\",\\n \\"MessageBodyMD5\\": \\"C5DD56A39F5F7BB8B3337C6D11B6D8BE\\",\\n \\"EnqueueTime\\": 1250700979348,\\n \\"NextVisibleTime\\": 1250700979348,\\n \\"FirstDequeueTime\\": 1250700979348,\\n \\"DequeueCount\\": 1,\\n \\"Priority\\": 1,\\n \\"MessageGroupId\\": \\"test-group\\",\\n \\"UserProperties\\": {\\n \\"key\\": {\\n \\"DataType\\": \\"\\",\\n \\"StringValue\\": \\"\\",\\n \\"BinaryValue\\": \\"\\"\\n }\\n }\\n}","type":"json"}]',
],
'SendMessage' => [
'path' => '/queues/{queueName}/messages',
'methods' => ['post'],
'schemes' => ['https'],
'security' => [
[
'AK' => [],
],
],
'consumes' => ['application/json'],
'produces' => ['application/json'],
'operationType' => 'write',
'deprecated' => false,
'systemTags' => ['operationType' => 'create', 'riskType' => 'none', 'chargeType' => 'paid'],
'parameters' => [
[
'name' => 'queueName',
'in' => 'path',
'schema' => ['description' => '**队列名称**'."\n", 'type' => 'string', 'required' => false, 'example' => 'MyQueue'],
],
[
'name' => 'body',
'in' => 'body',
'style' => 'json',
'schema' => [
'description' => '请求Body',
'type' => 'object',
'properties' => [
'MessageBody' => ['description' => '**消息正文**。建议事先进行 Base64 编码以避免特殊字符问题。'."\n", 'type' => 'string', 'required' => false, 'example' => '"Hello MNS"'],
'DelaySeconds' => ['description' => '**消息发送后延迟可被消费的时间**,单位:秒。最大 7 天。'."\n", 'type' => 'integer', 'format' => 'int32', 'required' => false, 'example' => '0'],
'Priority' => ['description' => '**消息优先级**。数值越小优先级越高,1 为最高优先级。'."\n", 'type' => 'integer', 'format' => 'int32', 'required' => false, 'example' => '2'],
'MessageGroupId' => ['description' => '**消息分组 ID**,同一分组内的消息保证顺序投递。仅 FIFO 队列有效'."\n", 'type' => 'string', 'required' => false, 'example' => 'group-123'],
'UserProperties' => [
'description' => '用户自定义属性。'."\n",
'type' => 'object',
'required' => false,
'example' => '{"key1":"value1", "key2":"value2"}',
'additionalProperties' => [
'type' => 'object',
'properties' => [
'DataType' => ['type' => 'string'],
'StringValue' => ['type' => 'string'],
'BinaryValue' => ['type' => 'string'],
],
],
],
],
'required' => false,
'example' => '{'."\n"
.' "MessageBody": "Hello MNS",'."\n"
.' "DelaySeconds": 60,'."\n"
.' "Priority": 1'."\n"
.'}',
],
],
],
'responses' => [
200 => [
'schema' => [
'type' => 'object',
'properties' => [
'MessageId' => ['type' => 'string'],
'MessageBodyMD5' => ['type' => 'string'],
'ReceiptHandle' => ['type' => 'string'],
],
],
],
],
'staticInfo' => ['returnType' => 'synchronous'],
'title' => '发送消息到队列',
'summary' => '向指定的队列发送一条消息,支持设置延迟和优先级。',
'description' => '## 请求说明'."\n"
.'- **SendMessage** 接口用于将消息发送至指定队列。'."\n"
.'- 消息可以立即被消费或通过设置 `DelaySeconds` 参数来延迟消费。'."\n"
.'- 发送的消息可以指定优先级,数值越小表示优先级越高。'."\n"
.'- 对于 FIFO 队列,可以通过 `MessageGroupId` 来保证同一分组内消息的顺序投递。'."\n"
.'- 用户还可以自定义属性 `UserProperties`,以 JSON 格式字符串形式提供额外信息。'."\n"
.'- 当 `DelaySeconds` 大于 0 时,API 返回的 `ReceiptHandle` 可用来在消息变为 Active 状态前删除该延迟消息。'."\n",
'changeSet' => [],
'responseDemo' => '[{"errorExample":"","example":"{\\n \\"MessageId\\": \\"\\",\\n \\"MessageBodyMD5\\": \\"\\",\\n \\"ReceiptHandle\\": \\"\\"\\n}","type":"json"}]',
],
],
'endpoints' => [],
'errorCodes' => [],
'changeSet' => [],
];
|