redqueue 0.10.0__tar.gz → 0.10.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. {redqueue-0.10.0 → redqueue-0.10.1}/CHANGELOG.md +40 -0
  2. {redqueue-0.10.0 → redqueue-0.10.1}/LICENSE +158 -158
  3. {redqueue-0.10.0 → redqueue-0.10.1}/PKG-INFO +22 -9
  4. {redqueue-0.10.0 → redqueue-0.10.1}/README.md +21 -8
  5. {redqueue-0.10.0 → redqueue-0.10.1}/docs/API.md +2 -2
  6. redqueue-0.10.1/examples/README.md +50 -0
  7. redqueue-0.10.1/examples/__init__.py +4 -0
  8. redqueue-0.10.1/examples/async_list_queue.py +42 -0
  9. redqueue-0.10.1/examples/common.py +16 -0
  10. redqueue-0.10.1/examples/compatibility_check.py +40 -0
  11. redqueue-0.10.1/examples/custom_serializer.py +50 -0
  12. redqueue-0.10.1/examples/delayed_tasks.py +38 -0
  13. redqueue-0.10.1/examples/monitoring_hooks.py +56 -0
  14. redqueue-0.10.1/examples/stream_queue.py +42 -0
  15. redqueue-0.10.1/examples/sync_list_queue.py +63 -0
  16. {redqueue-0.10.0 → redqueue-0.10.1}/pyproject.toml +1 -1
  17. {redqueue-0.10.0 → redqueue-0.10.1}/requirements.txt +3 -0
  18. {redqueue-0.10.0 → redqueue-0.10.1}/src/redqueue/_version.py +1 -1
  19. {redqueue-0.10.0 → redqueue-0.10.1}/src/redqueue/async_client.py +155 -1
  20. {redqueue-0.10.0 → redqueue-0.10.1}/src/redqueue/backends/async_delay.py +131 -8
  21. {redqueue-0.10.0 → redqueue-0.10.1}/src/redqueue/backends/async_list.py +139 -8
  22. {redqueue-0.10.0 → redqueue-0.10.1}/src/redqueue/backends/async_stream.py +216 -14
  23. {redqueue-0.10.0 → redqueue-0.10.1}/src/redqueue/backends/base.py +55 -1
  24. {redqueue-0.10.0 → redqueue-0.10.1}/src/redqueue/backends/delay.py +143 -13
  25. {redqueue-0.10.0 → redqueue-0.10.1}/src/redqueue/backends/list.py +141 -8
  26. {redqueue-0.10.0 → redqueue-0.10.1}/src/redqueue/backends/stream.py +210 -14
  27. redqueue-0.10.1/src/redqueue/client.py +331 -0
  28. {redqueue-0.10.0 → redqueue-0.10.1}/src/redqueue/compat.py +128 -8
  29. {redqueue-0.10.0 → redqueue-0.10.1}/src/redqueue/config.py +101 -8
  30. {redqueue-0.10.0 → redqueue-0.10.1}/src/redqueue/exceptions.py +76 -7
  31. redqueue-0.10.1/src/redqueue/message.py +130 -0
  32. {redqueue-0.10.0 → redqueue-0.10.1}/src/redqueue/monitoring.py +79 -6
  33. {redqueue-0.10.0 → redqueue-0.10.1}/src/redqueue/serialization.py +69 -4
  34. {redqueue-0.10.0 → redqueue-0.10.1}/tests/test_project_skeleton.py +227 -29
  35. redqueue-0.10.0/src/redqueue/client.py +0 -168
  36. redqueue-0.10.0/src/redqueue/message.py +0 -67
  37. {redqueue-0.10.0 → redqueue-0.10.1}/.github/workflows/ci.yml +0 -0
  38. {redqueue-0.10.0 → redqueue-0.10.1}/.gitignore +0 -0
  39. {redqueue-0.10.0 → redqueue-0.10.1}/NOTICE +0 -0
  40. {redqueue-0.10.0 → redqueue-0.10.1}/docs/RELEASE.md +0 -0
  41. {redqueue-0.10.0 → redqueue-0.10.1}/scripts/check.py +0 -0
  42. {redqueue-0.10.0 → redqueue-0.10.1}/src/redqueue/__init__.py +0 -0
  43. {redqueue-0.10.0 → redqueue-0.10.1}/src/redqueue/backends/__init__.py +0 -0
  44. {redqueue-0.10.0 → redqueue-0.10.1}/tests/README.md +0 -0
  45. {redqueue-0.10.0 → redqueue-0.10.1}/tests/__init__.py +0 -0
  46. {redqueue-0.10.0 → redqueue-0.10.1}/tests/fakes.py +0 -0
  47. {redqueue-0.10.0 → redqueue-0.10.1}/tests/test_backend_contracts.py +0 -0
  48. {redqueue-0.10.0 → redqueue-0.10.1}/tests/test_integration_redis.py +0 -0
@@ -7,6 +7,46 @@ All notable public release changes are documented here.
7
7
  Development versions are tracked separately from formal release versions.
8
8
  开发版本与正式版本分开管理。
9
9
 
10
+ ## [0.10.1] - 2026-06-20
11
+
12
+ ### Fixed
13
+
14
+ - Fixed Redis List `ack`, `nack`, `retry`, and dead-letter requeue when custom
15
+ serializers do not produce deterministic bytes.
16
+ - Fixed delayed task scheduling cleanup so payload keys are removed if `ZADD`
17
+ fails after `SET`.
18
+ - Fixed Streams dead-letter reads and moves by ensuring the consumer group also
19
+ exists on the dead-letter stream.
20
+ - Fixed async client creation monitoring so `AsyncQueueClient` emits the same
21
+ `client.created` event as the synchronous client.
22
+ - Removed duplicate delay scheduling monitoring events from the synchronous
23
+ client facade.
24
+ - Normalized internal Redis Streams entry ids returned as bytes.
25
+
26
+ ### 修复
27
+
28
+ - 修复自定义序列化器输出字节不稳定时,Redis List `ack`、`nack`、`retry`
29
+ 和死信重放无法精确删除原始消息的问题。
30
+ - 修复延迟任务在 `SET` 成功但 `ZADD` 失败时残留 payload key 的问题。
31
+ - 修复 Streams 死信读取和搬移前未确保死信 stream 消费组存在的问题。
32
+ - 修复异步客户端创建时未与同步客户端一致发出 `client.created` 监控事件的问题。
33
+ - 移除同步客户端门面层重复发出的延迟调度监控事件。
34
+ - 统一规范化 Redis Streams 返回的 bytes 类型 entry id。
35
+
36
+ ### Validation
37
+
38
+ - `python -m ruff check .`
39
+ - `PYTHONPATH=src python -m mypy`
40
+ - `PYTHONPATH=src python -m pytest`
41
+ - `REDQUEUE_REDIS_URL=redis://127.0.0.1:6379/0 PYTHONPATH=src python -m pytest -m integration`
42
+
43
+ ### 验证
44
+
45
+ - `python -m ruff check .`
46
+ - `PYTHONPATH=src python -m mypy`
47
+ - `PYTHONPATH=src python -m pytest`
48
+ - `REDQUEUE_REDIS_URL=redis://127.0.0.1:6379/0 PYTHONPATH=src python -m pytest -m integration`
49
+
10
50
  ## [0.10.0] - 2026-06-20
11
51
 
12
52
  ### Added
@@ -1,158 +1,158 @@
1
- Apache License
2
- Version 2.0, January 2004
3
- https://www.apache.org/licenses/
4
-
5
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
-
7
- 1. Definitions.
8
-
9
- "License" shall mean the terms and conditions for use, reproduction, and
10
- distribution as defined by Sections 1 through 9 of this document.
11
-
12
- "Licensor" shall mean the copyright owner or entity authorized by the copyright
13
- owner that is granting the License.
14
-
15
- "Legal Entity" shall mean the union of the acting entity and all other entities
16
- that control, are controlled by, or are under common control with that entity.
17
- For the purposes of this definition, "control" means (i) the power, direct or
18
- indirect, to cause the direction or management of such entity, whether by
19
- contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
20
- outstanding shares, or (iii) beneficial ownership of such entity.
21
-
22
- "You" (or "Your") shall mean an individual or Legal Entity exercising
23
- permissions granted by this License.
24
-
25
- "Source" form shall mean the preferred form for making modifications, including
26
- but not limited to software source code, documentation source, and configuration
27
- files.
28
-
29
- "Object" form shall mean any form resulting from mechanical transformation or
30
- translation of a Source form, including but not limited to compiled object code,
31
- generated documentation, and conversions to other media types.
32
-
33
- "Work" shall mean the work of authorship, whether in Source or Object form,
34
- made available under the License, as indicated by a copyright notice that is
35
- included in or attached to the work.
36
-
37
- "Derivative Works" shall mean any work, whether in Source or Object form, that
38
- is based on (or derived from) the Work and for which the editorial revisions,
39
- annotations, elaborations, or other modifications represent, as a whole, an
40
- original work of authorship. For the purposes of this License, Derivative Works
41
- shall not include works that remain separable from, or merely link (or bind by
42
- name) to the interfaces of, the Work and Derivative Works thereof.
43
-
44
- "Contribution" shall mean any work of authorship, including the original version
45
- of the Work and any modifications or additions to that Work or Derivative Works
46
- thereof, that is intentionally submitted to Licensor for inclusion in the Work
47
- by the copyright owner or by an individual or Legal Entity authorized to submit
48
- on behalf of the copyright owner. For the purposes of this definition,
49
- "submitted" means any form of electronic, verbal, or written communication sent
50
- to the Licensor or its representatives, including but not limited to
51
- communication on electronic mailing lists, source code control systems, and
52
- issue tracking systems that are managed by, or on behalf of, the Licensor for
53
- the purpose of discussing and improving the Work, but excluding communication
54
- that is conspicuously marked or otherwise designated in writing by the copyright
55
- owner as "Not a Contribution."
56
-
57
- "Contributor" shall mean Licensor and any individual or Legal Entity on behalf
58
- of whom a Contribution has been received by Licensor and subsequently
59
- incorporated within the Work.
60
-
61
- 2. Grant of Copyright License. Subject to the terms and conditions of this
62
- License, each Contributor hereby grants to You a perpetual, worldwide,
63
- non-exclusive, no-charge, royalty-free, irrevocable copyright license to
64
- reproduce, prepare Derivative Works of, publicly display, publicly perform,
65
- sublicense, and distribute the Work and such Derivative Works in Source or
66
- Object form.
67
-
68
- 3. Grant of Patent License. Subject to the terms and conditions of this License,
69
- each Contributor hereby grants to You a perpetual, worldwide, non-exclusive,
70
- no-charge, royalty-free, irrevocable patent license to make, have made, use,
71
- offer to sell, sell, import, and otherwise transfer the Work, where such license
72
- applies only to those patent claims licensable by such Contributor that are
73
- necessarily infringed by their Contribution(s) alone or by combination of their
74
- Contribution(s) with the Work to which such Contribution(s) was submitted. If
75
- You institute patent litigation against any entity (including a cross-claim or
76
- counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated
77
- within the Work constitutes direct or contributory patent infringement, then any
78
- patent licenses granted to You under this License for that Work shall terminate
79
- as of the date such litigation is filed.
80
-
81
- 4. Redistribution. You may reproduce and distribute copies of the Work or
82
- Derivative Works thereof in any medium, with or without modifications, and in
83
- Source or Object form, provided that You meet the following conditions:
84
-
85
- (a) You must give any other recipients of the Work or Derivative Works a copy of
86
- this License; and
87
-
88
- (b) You must cause any modified files to carry prominent notices stating that You
89
- changed the files; and
90
-
91
- (c) You must retain, in the Source form of any Derivative Works that You
92
- distribute, all copyright, patent, trademark, and attribution notices from the
93
- Source form of the Work, excluding those notices that do not pertain to any part
94
- of the Derivative Works; and
95
-
96
- (d) If the Work includes a "NOTICE" text file as part of its distribution, then
97
- any Derivative Works that You distribute must include a readable copy of the
98
- attribution notices contained within such NOTICE file, excluding those notices
99
- that do not pertain to any part of the Derivative Works, in at least one of the
100
- following places: within a NOTICE text file distributed as part of the
101
- Derivative Works; within the Source form or documentation, if provided along
102
- with the Derivative Works; or, within a display generated by the Derivative
103
- Works, if and wherever such third-party notices normally appear. The contents of
104
- the NOTICE file are for informational purposes only and do not modify the
105
- License. You may add Your own attribution notices within Derivative Works that
106
- You distribute, alongside or as an addendum to the NOTICE text from the Work,
107
- provided that such additional attribution notices cannot be construed as
108
- modifying the License.
109
-
110
- You may add Your own copyright statement to Your modifications and may provide
111
- additional or different license terms and conditions for use, reproduction, or
112
- distribution of Your modifications, or for any such Derivative Works as a whole,
113
- provided Your use, reproduction, and distribution of the Work otherwise complies
114
- with the conditions stated in this License.
115
-
116
- 5. Submission of Contributions. Unless You explicitly state otherwise, any
117
- Contribution intentionally submitted for inclusion in the Work by You to the
118
- Licensor shall be under the terms and conditions of this License, without any
119
- additional terms or conditions. Notwithstanding the above, nothing herein shall
120
- supersede or modify the terms of any separate license agreement you may have
121
- executed with Licensor regarding such Contributions.
122
-
123
- 6. Trademarks. This License does not grant permission to use the trade names,
124
- trademarks, service marks, or product names of the Licensor, except as required
125
- for reasonable and customary use in describing the origin of the Work and
126
- reproducing the content of the NOTICE file.
127
-
128
- 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in
129
- writing, Licensor provides the Work (and each Contributor provides its
130
- Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
131
- KIND, either express or implied, including, without limitation, any warranties or
132
- conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
133
- PARTICULAR PURPOSE. You are solely responsible for determining the
134
- appropriateness of using or redistributing the Work and assume any risks
135
- associated with Your exercise of permissions under this License.
136
-
137
- 8. Limitation of Liability. In no event and under no legal theory, whether in
138
- tort (including negligence), contract, or otherwise, unless required by
139
- applicable law (such as deliberate and grossly negligent acts) or agreed to in
140
- writing, shall any Contributor be liable to You for damages, including any
141
- direct, indirect, special, incidental, or consequential damages of any character
142
- arising as a result of this License or out of the use or inability to use the
143
- Work (including but not limited to damages for loss of goodwill, work stoppage,
144
- computer failure or malfunction, or any and all other commercial damages or
145
- losses), even if such Contributor has been advised of the possibility of such
146
- damages.
147
-
148
- 9. Accepting Warranty or Additional Liability. While redistributing the Work or
149
- Derivative Works thereof, You may choose to offer, and charge a fee for,
150
- acceptance of support, warranty, indemnity, or other liability obligations
151
- and/or rights consistent with this License. However, in accepting such
152
- obligations, You may act only on Your own behalf and on Your sole
153
- responsibility, not on behalf of any other Contributor, and only if You agree to
154
- indemnify, defend, and hold each Contributor harmless for any liability incurred
155
- by, or claims asserted against, such Contributor by reason of your accepting any
156
- such warranty or additional liability.
157
-
158
- END OF TERMS AND CONDITIONS
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ https://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction, and
10
+ distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by the copyright
13
+ owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all other entities
16
+ that control, are controlled by, or are under common control with that entity.
17
+ For the purposes of this definition, "control" means (i) the power, direct or
18
+ indirect, to cause the direction or management of such entity, whether by
19
+ contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
20
+ outstanding shares, or (iii) beneficial ownership of such entity.
21
+
22
+ "You" (or "Your") shall mean an individual or Legal Entity exercising
23
+ permissions granted by this License.
24
+
25
+ "Source" form shall mean the preferred form for making modifications, including
26
+ but not limited to software source code, documentation source, and configuration
27
+ files.
28
+
29
+ "Object" form shall mean any form resulting from mechanical transformation or
30
+ translation of a Source form, including but not limited to compiled object code,
31
+ generated documentation, and conversions to other media types.
32
+
33
+ "Work" shall mean the work of authorship, whether in Source or Object form,
34
+ made available under the License, as indicated by a copyright notice that is
35
+ included in or attached to the work.
36
+
37
+ "Derivative Works" shall mean any work, whether in Source or Object form, that
38
+ is based on (or derived from) the Work and for which the editorial revisions,
39
+ annotations, elaborations, or other modifications represent, as a whole, an
40
+ original work of authorship. For the purposes of this License, Derivative Works
41
+ shall not include works that remain separable from, or merely link (or bind by
42
+ name) to the interfaces of, the Work and Derivative Works thereof.
43
+
44
+ "Contribution" shall mean any work of authorship, including the original version
45
+ of the Work and any modifications or additions to that Work or Derivative Works
46
+ thereof, that is intentionally submitted to Licensor for inclusion in the Work
47
+ by the copyright owner or by an individual or Legal Entity authorized to submit
48
+ on behalf of the copyright owner. For the purposes of this definition,
49
+ "submitted" means any form of electronic, verbal, or written communication sent
50
+ to the Licensor or its representatives, including but not limited to
51
+ communication on electronic mailing lists, source code control systems, and
52
+ issue tracking systems that are managed by, or on behalf of, the Licensor for
53
+ the purpose of discussing and improving the Work, but excluding communication
54
+ that is conspicuously marked or otherwise designated in writing by the copyright
55
+ owner as "Not a Contribution."
56
+
57
+ "Contributor" shall mean Licensor and any individual or Legal Entity on behalf
58
+ of whom a Contribution has been received by Licensor and subsequently
59
+ incorporated within the Work.
60
+
61
+ 2. Grant of Copyright License. Subject to the terms and conditions of this
62
+ License, each Contributor hereby grants to You a perpetual, worldwide,
63
+ non-exclusive, no-charge, royalty-free, irrevocable copyright license to
64
+ reproduce, prepare Derivative Works of, publicly display, publicly perform,
65
+ sublicense, and distribute the Work and such Derivative Works in Source or
66
+ Object form.
67
+
68
+ 3. Grant of Patent License. Subject to the terms and conditions of this License,
69
+ each Contributor hereby grants to You a perpetual, worldwide, non-exclusive,
70
+ no-charge, royalty-free, irrevocable patent license to make, have made, use,
71
+ offer to sell, sell, import, and otherwise transfer the Work, where such license
72
+ applies only to those patent claims licensable by such Contributor that are
73
+ necessarily infringed by their Contribution(s) alone or by combination of their
74
+ Contribution(s) with the Work to which such Contribution(s) was submitted. If
75
+ You institute patent litigation against any entity (including a cross-claim or
76
+ counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated
77
+ within the Work constitutes direct or contributory patent infringement, then any
78
+ patent licenses granted to You under this License for that Work shall terminate
79
+ as of the date such litigation is filed.
80
+
81
+ 4. Redistribution. You may reproduce and distribute copies of the Work or
82
+ Derivative Works thereof in any medium, with or without modifications, and in
83
+ Source or Object form, provided that You meet the following conditions:
84
+
85
+ (a) You must give any other recipients of the Work or Derivative Works a copy of
86
+ this License; and
87
+
88
+ (b) You must cause any modified files to carry prominent notices stating that You
89
+ changed the files; and
90
+
91
+ (c) You must retain, in the Source form of any Derivative Works that You
92
+ distribute, all copyright, patent, trademark, and attribution notices from the
93
+ Source form of the Work, excluding those notices that do not pertain to any part
94
+ of the Derivative Works; and
95
+
96
+ (d) If the Work includes a "NOTICE" text file as part of its distribution, then
97
+ any Derivative Works that You distribute must include a readable copy of the
98
+ attribution notices contained within such NOTICE file, excluding those notices
99
+ that do not pertain to any part of the Derivative Works, in at least one of the
100
+ following places: within a NOTICE text file distributed as part of the
101
+ Derivative Works; within the Source form or documentation, if provided along
102
+ with the Derivative Works; or, within a display generated by the Derivative
103
+ Works, if and wherever such third-party notices normally appear. The contents of
104
+ the NOTICE file are for informational purposes only and do not modify the
105
+ License. You may add Your own attribution notices within Derivative Works that
106
+ You distribute, alongside or as an addendum to the NOTICE text from the Work,
107
+ provided that such additional attribution notices cannot be construed as
108
+ modifying the License.
109
+
110
+ You may add Your own copyright statement to Your modifications and may provide
111
+ additional or different license terms and conditions for use, reproduction, or
112
+ distribution of Your modifications, or for any such Derivative Works as a whole,
113
+ provided Your use, reproduction, and distribution of the Work otherwise complies
114
+ with the conditions stated in this License.
115
+
116
+ 5. Submission of Contributions. Unless You explicitly state otherwise, any
117
+ Contribution intentionally submitted for inclusion in the Work by You to the
118
+ Licensor shall be under the terms and conditions of this License, without any
119
+ additional terms or conditions. Notwithstanding the above, nothing herein shall
120
+ supersede or modify the terms of any separate license agreement you may have
121
+ executed with Licensor regarding such Contributions.
122
+
123
+ 6. Trademarks. This License does not grant permission to use the trade names,
124
+ trademarks, service marks, or product names of the Licensor, except as required
125
+ for reasonable and customary use in describing the origin of the Work and
126
+ reproducing the content of the NOTICE file.
127
+
128
+ 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in
129
+ writing, Licensor provides the Work (and each Contributor provides its
130
+ Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
131
+ KIND, either express or implied, including, without limitation, any warranties or
132
+ conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
133
+ PARTICULAR PURPOSE. You are solely responsible for determining the
134
+ appropriateness of using or redistributing the Work and assume any risks
135
+ associated with Your exercise of permissions under this License.
136
+
137
+ 8. Limitation of Liability. In no event and under no legal theory, whether in
138
+ tort (including negligence), contract, or otherwise, unless required by
139
+ applicable law (such as deliberate and grossly negligent acts) or agreed to in
140
+ writing, shall any Contributor be liable to You for damages, including any
141
+ direct, indirect, special, incidental, or consequential damages of any character
142
+ arising as a result of this License or out of the use or inability to use the
143
+ Work (including but not limited to damages for loss of goodwill, work stoppage,
144
+ computer failure or malfunction, or any and all other commercial damages or
145
+ losses), even if such Contributor has been advised of the possibility of such
146
+ damages.
147
+
148
+ 9. Accepting Warranty or Additional Liability. While redistributing the Work or
149
+ Derivative Works thereof, You may choose to offer, and charge a fee for,
150
+ acceptance of support, warranty, indemnity, or other liability obligations
151
+ and/or rights consistent with this License. However, in accepting such
152
+ obligations, You may act only on Your own behalf and on Your sole
153
+ responsibility, not on behalf of any other Contributor, and only if You agree to
154
+ indemnify, defend, and hold each Contributor harmless for any liability incurred
155
+ by, or claims asserted against, such Contributor by reason of your accepting any
156
+ such warranty or additional liability.
157
+
158
+ END OF TERMS AND CONDITIONS
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: redqueue
3
- Version: 0.10.0
3
+ Version: 0.10.1
4
4
  Summary: Redis-backed Python message queue library with List, Streams, delayed tasks, and monitoring.
5
5
  Project-URL: Homepage, https://github.com/SpringMirror-pear/redqueue
6
6
  Project-URL: Repository, https://github.com/SpringMirror-pear/redqueue.git
@@ -269,15 +269,36 @@ released = client.schedule_due(limit=100)
269
269
  ## Documentation / 文档
270
270
 
271
271
  - API: [docs/API.md](docs/API.md)
272
+ - Examples: [examples/README.md](examples/README.md)
272
273
  - Changelog: [CHANGELOG.md](CHANGELOG.md)
273
274
  - Release process: [docs/RELEASE.md](docs/RELEASE.md)
274
275
  - Test guide: [tests/README.md](tests/README.md)
275
276
 
276
277
  - API 文档:[docs/API.md](docs/API.md)
278
+ - 示例代码:[examples/README.md](examples/README.md)
277
279
  - 版本变更记录:[CHANGELOG.md](CHANGELOG.md)
278
280
  - 发布流程:[docs/RELEASE.md](docs/RELEASE.md)
279
281
  - 测试指南:[tests/README.md](tests/README.md)
280
282
 
283
+ ## Examples / 示例
284
+
285
+ The `examples/` directory contains runnable scripts for synchronous List queues,
286
+ asynchronous List queues, Streams, delayed tasks, monitoring hooks, custom
287
+ serializers, and Redis compatibility checks.
288
+
289
+ `examples/` 目录包含可运行脚本,覆盖同步 List 队列、异步 List 队列、Streams、
290
+ 延迟任务、监控 hook、自定义序列化器和 Redis 兼容性检查。
291
+
292
+ ```bash
293
+ PYTHONPATH=src python examples/sync_list_queue.py
294
+ PYTHONPATH=src python examples/async_list_queue.py
295
+ PYTHONPATH=src python examples/stream_queue.py
296
+ PYTHONPATH=src python examples/delayed_tasks.py
297
+ PYTHONPATH=src python examples/monitoring_hooks.py
298
+ PYTHONPATH=src python examples/custom_serializer.py
299
+ PYTHONPATH=src python examples/compatibility_check.py
300
+ ```
301
+
281
302
  ## Testing / 测试
282
303
 
283
304
  ```bash
@@ -296,14 +317,6 @@ REDQUEUE_REDIS_URL=redis://127.0.0.1:6379/0 PYTHONPATH=src python -m pytest -m i
296
317
  REDQUEUE_REDIS_URL=redis://127.0.0.1:6379/0 PYTHONPATH=src python -m pytest -m integration
297
318
  ```
298
319
 
299
- ## Versioning / 版本规则
300
-
301
- Development versions and formal release versions are separate streams.
302
- `0.10.0devN` records development milestones. The first formal release is
303
- `0.10.0`.
304
-
305
- 开发版本与正式版本不互通。`0.10.0devN` 用于记录开发里程碑,第一个正式版本为
306
- `0.10.0`。
307
320
 
308
321
  ## License / 许可证
309
322
 
@@ -236,15 +236,36 @@ released = client.schedule_due(limit=100)
236
236
  ## Documentation / 文档
237
237
 
238
238
  - API: [docs/API.md](docs/API.md)
239
+ - Examples: [examples/README.md](examples/README.md)
239
240
  - Changelog: [CHANGELOG.md](CHANGELOG.md)
240
241
  - Release process: [docs/RELEASE.md](docs/RELEASE.md)
241
242
  - Test guide: [tests/README.md](tests/README.md)
242
243
 
243
244
  - API 文档:[docs/API.md](docs/API.md)
245
+ - 示例代码:[examples/README.md](examples/README.md)
244
246
  - 版本变更记录:[CHANGELOG.md](CHANGELOG.md)
245
247
  - 发布流程:[docs/RELEASE.md](docs/RELEASE.md)
246
248
  - 测试指南:[tests/README.md](tests/README.md)
247
249
 
250
+ ## Examples / 示例
251
+
252
+ The `examples/` directory contains runnable scripts for synchronous List queues,
253
+ asynchronous List queues, Streams, delayed tasks, monitoring hooks, custom
254
+ serializers, and Redis compatibility checks.
255
+
256
+ `examples/` 目录包含可运行脚本,覆盖同步 List 队列、异步 List 队列、Streams、
257
+ 延迟任务、监控 hook、自定义序列化器和 Redis 兼容性检查。
258
+
259
+ ```bash
260
+ PYTHONPATH=src python examples/sync_list_queue.py
261
+ PYTHONPATH=src python examples/async_list_queue.py
262
+ PYTHONPATH=src python examples/stream_queue.py
263
+ PYTHONPATH=src python examples/delayed_tasks.py
264
+ PYTHONPATH=src python examples/monitoring_hooks.py
265
+ PYTHONPATH=src python examples/custom_serializer.py
266
+ PYTHONPATH=src python examples/compatibility_check.py
267
+ ```
268
+
248
269
  ## Testing / 测试
249
270
 
250
271
  ```bash
@@ -263,14 +284,6 @@ REDQUEUE_REDIS_URL=redis://127.0.0.1:6379/0 PYTHONPATH=src python -m pytest -m i
263
284
  REDQUEUE_REDIS_URL=redis://127.0.0.1:6379/0 PYTHONPATH=src python -m pytest -m integration
264
285
  ```
265
286
 
266
- ## Versioning / 版本规则
267
-
268
- Development versions and formal release versions are separate streams.
269
- `0.10.0devN` records development milestones. The first formal release is
270
- `0.10.0`.
271
-
272
- 开发版本与正式版本不互通。`0.10.0devN` 用于记录开发里程碑,第一个正式版本为
273
- `0.10.0`。
274
287
 
275
288
  ## License / 许可证
276
289
 
@@ -1,8 +1,8 @@
1
1
  # RedQueue API / RedQueue API 文档
2
2
 
3
- This document describes the public API available in RedQueue `0.10.0`.
3
+ This document describes the public API available in RedQueue `0.10.1`.
4
4
 
5
- 本文档描述 RedQueue `0.10.0` 的公开 API。
5
+ 本文档描述 RedQueue `0.10.1` 的公开 API。
6
6
 
7
7
  ## Clients / 客户端
8
8
 
@@ -0,0 +1,50 @@
1
+ # RedQueue Examples / RedQueue 示例
2
+
3
+ These examples cover the main RedQueue features. They expect Redis to be
4
+ available at `redis://127.0.0.1:6379/0` unless `REDQUEUE_REDIS_URL` is set.
5
+
6
+ 这些示例覆盖 RedQueue 的主要功能。默认使用
7
+ `redis://127.0.0.1:6379/0`,也可以通过 `REDQUEUE_REDIS_URL` 指定 Redis。
8
+
9
+ ## Run / 运行
10
+
11
+ From the repository root:
12
+
13
+ ```bash
14
+ PYTHONPATH=src python examples/sync_list_queue.py
15
+ ```
16
+
17
+ 在仓库根目录执行:
18
+
19
+ ```bash
20
+ PYTHONPATH=src python examples/sync_list_queue.py
21
+ ```
22
+
23
+ ## Files / 文件
24
+
25
+ - `sync_list_queue.py`: synchronous List publish, consume, ack, nack, retry,
26
+ dead letter, and recovery.
27
+ - `async_list_queue.py`: asynchronous List publish, consume, ack, retry, and
28
+ close.
29
+ - `stream_queue.py`: Streams consumer group publish, consume, ack, pending
30
+ recovery, and compatibility failure handling.
31
+ - `delayed_tasks.py`: delayed task scheduling with Sorted Set and
32
+ `schedule_due`.
33
+ - `monitoring_hooks.py`: in-memory, composite, and safe monitoring hooks.
34
+ - `custom_serializer.py`: custom serializer protocol.
35
+ - `compatibility_check.py`: explicit Redis capability detection and Streams
36
+ version guard.
37
+
38
+ - `sync_list_queue.py`:同步 List 发布、消费、ack、nack、retry、死信和恢复。
39
+ - `async_list_queue.py`:异步 List 发布、消费、ack、retry 和关闭连接。
40
+ - `stream_queue.py`:Streams 消费组发布、消费、ack、pending 恢复和兼容性失败处理。
41
+ - `delayed_tasks.py`:基于 Sorted Set 的延迟任务和 `schedule_due`。
42
+ - `monitoring_hooks.py`:内存 hook、组合 hook 和安全 hook。
43
+ - `custom_serializer.py`:自定义序列化协议。
44
+ - `compatibility_check.py`:显式 Redis 能力探测和 Streams 版本保护。
45
+
46
+ ## Notes / 注意
47
+
48
+ Examples use queue names prefixed with `redqueue-example-`.
49
+
50
+ 示例使用 `redqueue-example-` 前缀的队列名。
@@ -0,0 +1,4 @@
1
+ # SPDX-License-Identifier: Apache-2.0
2
+ # Author: SpringMirror-pear
3
+
4
+ """Runnable RedQueue examples."""
@@ -0,0 +1,42 @@
1
+ # SPDX-License-Identifier: Apache-2.0
2
+ # Author: SpringMirror-pear
3
+
4
+ """Asynchronous Redis List queue example."""
5
+
6
+ from __future__ import annotations
7
+
8
+ import asyncio
9
+
10
+ from common import REDIS_URL, example_queue
11
+
12
+ from redqueue import AsyncQueueClient, RetryConfig
13
+
14
+
15
+ async def main() -> None:
16
+ client = await AsyncQueueClient.from_url(
17
+ REDIS_URL,
18
+ queue=example_queue("async-list"),
19
+ backend="list",
20
+ retry=RetryConfig(max_retries=1),
21
+ )
22
+ try:
23
+ message_id = await client.publish({"task": "render-report"})
24
+ message = await client.consume(timeout=1)
25
+ if message is not None:
26
+ print(f"published={message_id} consumed={message.id}")
27
+ await client.ack(message)
28
+
29
+ await client.publish({"task": "retry-once"})
30
+ failed = await client.consume(timeout=1)
31
+ if failed is not None:
32
+ await client.retry(failed, reason="transient failure")
33
+ retried = await client.consume(timeout=1)
34
+ if retried is not None:
35
+ await client.nack(retried, requeue=False)
36
+ print(f"dead_letters={len(await client.dead_letters())}")
37
+ finally:
38
+ await client.close()
39
+
40
+
41
+ if __name__ == "__main__":
42
+ asyncio.run(main())
@@ -0,0 +1,16 @@
1
+ # SPDX-License-Identifier: Apache-2.0
2
+ # Author: SpringMirror-pear
3
+
4
+ """Shared helpers for RedQueue examples."""
5
+
6
+ from __future__ import annotations
7
+
8
+ import os
9
+
10
+ REDIS_URL = os.getenv("REDQUEUE_REDIS_URL", "redis://127.0.0.1:6379/0")
11
+
12
+
13
+ def example_queue(name: str) -> str:
14
+ """Return a namespaced example queue name."""
15
+
16
+ return f"redqueue-example-{name}"
@@ -0,0 +1,40 @@
1
+ # SPDX-License-Identifier: Apache-2.0
2
+ # Author: SpringMirror-pear
3
+
4
+ """Redis compatibility detection example."""
5
+
6
+ from __future__ import annotations
7
+
8
+ from common import REDIS_URL, example_queue
9
+ from redis import Redis
10
+
11
+ from redqueue import (
12
+ QueueClient,
13
+ QueueConfig,
14
+ RedisCapabilities,
15
+ RedisCompatibilityError,
16
+ RedisVersion,
17
+ detect_capabilities,
18
+ )
19
+
20
+
21
+ def main() -> None:
22
+ redis = Redis.from_url(REDIS_URL)
23
+ capabilities = detect_capabilities(redis)
24
+ print(f"redis_version={capabilities.version}")
25
+ print(f"supports_streams={capabilities.supports_streams}")
26
+ print(f"supports_blmove={capabilities.supports_list_reliable_blmove}")
27
+ print(f"supports_xautoclaim={capabilities.supports_streams_auto_claim}")
28
+
29
+ try:
30
+ QueueClient(
31
+ QueueConfig(queue=example_queue("compat"), backend="stream"),
32
+ redis=redis,
33
+ capabilities=RedisCapabilities(RedisVersion(4, 0, 14)),
34
+ )
35
+ except RedisCompatibilityError as exc:
36
+ print(exc.to_dict())
37
+
38
+
39
+ if __name__ == "__main__":
40
+ main()