Python examples: add a multi-tenant producer and consumer

已关闭
#4,697 6 条评论 0 个 reaction 已指派 1 人 在 GitHub 查看

维护者通常 1 天内回复

@chihumyum 已经在做这个了。

开始于 2026年11月4日。

  • #4720 来自 @08abhinav —— 已关闭,未合并
  • #4751 来自 @chihumyum —— 已合并

评估

难度
3/5
预计耗时
1-2 天
新手友好度
72/100
Issue 类型
功能
描述清晰度
描述清楚
活跃度
活跃
技术栈
python

调研方向

Start with the Rust model at examples/rust/src/multi-tenant/producer/main.rs and the existing Python helper in examples/python/message-headers/common.py, then look at the permission classes and create_user/update_permissions in foreign/python/apache_iggy.pyi. Add examples/python/multi-tenant/producer.py and consumer.py plus a section in examples/python/README.md. Done when both scripts run with uv run against a fresh server, the producer shows that cross-tenant access is refused, and the README lists the commands.

由索引模型根据 Issue 内容生成。

描述

good first issue python
Description

The Rust, Java and Node examples include a multi-tenant example: each tenant gets its own stream and its own user, limited to that stream, and the example shows that a tenant cannot reach another tenant's stream. The Python examples have none.

Affected area / component

Python examples

Proposed solution

Add examples/python/multi-tenant/producer.py and consumer.py, and a README section in examples/python/README.md.

  • Use examples/rust/src/multi-tenant/producer/main.rs as the model. It takes the tenant count from TENANTS_COUNT (default 3) and checks that other tenants' streams are refused.
  • The Python SDK already has create_user (with an optional permissions argument), update_permissions, and the Permissions, GlobalPermissions, StreamPermissions and TopicPermissions classes in foreign/python/apache_iggy.pyi.
  • The producer creates each tenant's stream, topic and restricted user, sends messages as each tenant, and prints that reading another tenant's stream fails.
  • The consumer reads one tenant's stream as that tenant.
  • Use the argument and logging style of message-headers/common.py.

How to test: start a fresh server, then run both scripts with uv run from examples/python. The README should list the commands.

Good first issue
  • I think this could be a good first issue for a new contributor
主要语言
Rust
星标
5.2k
派生
502
平均合并
3 天 3 小时
30 天内合并 PR
163

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

apache/iggy 的其他 Issue

查看 apache/iggy 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。