Files
orbit/sdk/go/examples/resource-lifecycle/README.md

17 lines
1.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 队列和订阅的通用退役示例
用途:为一次独立回归创建专属空队列和订阅,然后退役订阅、重报原操作验证幂等、退役队列。不会提交任务,也不会修改现有队列或任何业务凭据。名称随机生成,没有行业或接入方约定。
需要已部署迁移 000034 的 Orbit、`queues:manage/queues:read/events:manage` 权限及允许创建新队列的范围。配置 `ORBIT_URL` 和 `ORBIT_TOKEN`,或使用 `ORBIT_CREDENTIALS_FILE` 引用自己的 SDK 凭据文件。
```sh
cd sdk/go
export ORBIT_URL=http://127.0.0.1:18080
export ORBIT_CREDENTIALS_FILE=/absolute/path/to/sdk.credentials.json
go run ./examples/resource-lifecycle
```
预期输出只有本次资源 ID,以及 `retired=true history_preserved=true subscription_replay=true`。控制台仍能查询历史,订阅不再占活动名额。
若中途失败,示例以非零状态退出;保留已经打印的 ID,按[退役规则](../../../../docs/api/resource-retirement.md)核查并收尾。生产部署应持久保存每条退役命令的幂等键、目标及原请求,网络不明确时重报同一条命令。