gws-events-subscribe
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chineseevents +subscribe
events +subscribe
PREREQUISITE: Readfor auth, global flags, and security rules. If missing, run../gws-shared/SKILL.mdto create it.gws generate-skills
Subscribe to Workspace events and stream them as NDJSON
前置要求: 阅读了解认证、全局标志和安全规则。如果该文件缺失,请运行../gws-shared/SKILL.md创建它。gws generate-skills
订阅Workspace事件并以NDJSON格式流式输出
Usage
使用方法
bash
gws events +subscribebash
gws events +subscribeFlags
标志参数
| Flag | Required | Default | Description |
|---|---|---|---|
| — | — | Workspace resource URI (e.g., //chat.googleapis.com/spaces/SPACE_ID) |
| — | — | Comma-separated CloudEvents types to subscribe to |
| — | — | GCP project ID for Pub/Sub resources |
| — | — | Existing Pub/Sub subscription name (skip setup) |
| — | 10 | Max messages per pull batch (default: 10) |
| — | 5 | Seconds between pulls (default: 5) |
| — | — | Pull once and exit |
| — | — | Delete created Pub/Sub resources on exit |
| — | — | Don't auto-acknowledge messages |
| — | — | Write each event to a separate JSON file in this directory |
| 标志 | 是否必填 | 默认值 | 描述 |
|---|---|---|---|
| — | — | Workspace资源URI(例如://chat.googleapis.com/spaces/SPACE_ID) |
| — | — | 要订阅的CloudEvents类型,以逗号分隔 |
| — | — | Pub/Sub资源对应的GCP项目ID |
| — | — | 已有的Pub/Sub订阅名称(跳过设置步骤) |
| — | 10 | 每次拉取的最大消息数(默认值:10) |
| — | 5 | 拉取间隔时间(秒,默认值:5) |
| — | — | 仅拉取一次后退出 |
| — | — | 退出时删除创建的Pub/Sub资源 |
| — | — | 不自动确认消息 |
| — | — | 将每个事件写入该目录下的独立JSON文件 |
Examples
示例
bash
gws events +subscribe --target '//chat.googleapis.com/spaces/SPACE' --event-types 'google.workspace.chat.message.v1.created' --project my-project
gws events +subscribe --subscription projects/p/subscriptions/my-sub --once
gws events +subscribe ... --cleanup --output-dir ./eventsbash
gws events +subscribe --target '//chat.googleapis.com/spaces/SPACE' --event-types 'google.workspace.chat.message.v1.created' --project my-project
gws events +subscribe --subscription projects/p/subscriptions/my-sub --once
gws events +subscribe ... --cleanup --output-dir ./eventsTips
提示
- Without --cleanup, Pub/Sub resources persist for reconnection.
- Press Ctrl-C to stop gracefully.
[!CAUTION] This is a write command — confirm with the user before executing.
- 如果不使用,Pub/Sub资源会保留以便重新连接。
--cleanup - 按Ctrl-C可优雅停止程序。
[!注意] 这是一个写入类命令——执行前请与用户确认。
See Also
另请参阅
- gws-shared — Global flags and auth
- gws-events — All subscribe to google workspace events commands
- gws-shared — 全局标志和认证
- gws-events — 所有Google Workspace事件订阅相关命令