-
Notifications
You must be signed in to change notification settings - Fork 2.3k
feat: add Apache Pulsar EventBus implementation #2019
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
- Add Pulsar producer and consumer implementations - Integrate Pulsar support into main EventBus factory - Add configuration constants for Pulsar service URL and JWT token - Update environment configuration to include Pulsar option - Add comprehensive tests for Pulsar implementation - Support all existing EventBus interfaces and options - Use Exclusive subscription mode for better message ordering - Add Docker Compose configurations for Pulsar deployment This implementation allows coze-studio to use Apache Pulsar as a message queue alongside the existing NSQ, Kafka, and RocketMQ options.
- Add Pulsar support to .env.debug.example - Include PULSAR_SERVICE_URL and PULSAR_JWT_TOKEN configuration - Update COZE_MQ_TYPE comment to include pulsar option - Maintain consistency with main .env.example configuration
} | ||
|
||
// Create Pulsar client | ||
fmt.Printf("[DEBUG] Creating Pulsar client with URL: %s\n", serviceURL) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK,logs 我整体调整下
@@ -0,0 +1,389 @@ | |||
name: coze-studio |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
为什么加两个 docker-compose
文件?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @fanlv 您好,
- docker/docker-compose-external-pulsar.yml 这个启动的时候时候不包含 Pulsar 服务,主要用来模拟采用外部 Pulsar 作为 eventbus的场景。
- docker/docker-compose-pulsar.ym 这个是默认启动一个 Pulsar 服务,方便直接使用的场景。
希望都能保留着啊。如果分优先级的话,希望优先保留docker/docker-compose-external-pulsar.yml,这个可以一键启动使用包含 Pulsar 作为 backend eventbus 版本的 coze
…Replace all fmt.Printf/fmt.Println with logs.Debugf/logs.Errorf in producer.go- Use t.Logf/t.Errorf in test files instead of fmt.Println- Maintain consistency with default EventBus implementations (NSQ style)- Ensure proper logging practices across the codebase
Description
Add Apache Pulsar support as a new EventBus implementation for coze-studio, providing users with a powerful, enterprise-grade message queue option that enhances coze-studio's scalability and security capabilities.
Why Pulsar?
As coze-studio grows and handles larger data volumes, the platform requires a message queue solution that can scale seamlessly while maintaining strong consistency guarantees. Apache Pulsar offers:
Changes
COZE_MQ_TYPE=pulsar
Configuration
Enable Pulsar EventBus
export COZE_MQ_TYPE="pulsar"
export MQ_NAME_SERVER="pulsar:6650"
export PULSAR_SERVICE_URL="pulsar://pulsar:6650"
export PULSAR_JWT_TOKEN="" # Optional JWT token for authentication
Testing
Breaking Changes
None. This is a purely additive feature that maintains full backward compatibility.
What type of PR is this?
feat: A new feature
Check the PR title.
(Optional) Translate the PR title into Chinese.
feat: 添加 Apache Pulsar EventBus 实现
(Optional) More detailed description for this PR(en: English/zh: Chinese).
en: This PR introduces Apache Pulsar as a new message queue backend for coze-studio's EventBus system. Users can now configure COZE_MQ_TYPE=pulsar to use Pulsar instead of NSQ, Kafka, or RocketMQ. The implementation includes JWT authentication support, Docker Compose configurations for easy deployment, and maintains full compatibility with existing EventBus interfaces. The Exclusive subscription mode ensures better message ordering for event processing, making it ideal for production environments requiring high throughput and strong consistency guarantees.
zh(optional): 此 PR 为 coze-studio 的 EventBus 系统引入了 Apache Pulsar 作为新的消息队列后端。用户现在可以通过配置 COZE_MQ_TYPE=pulsar 来使用 Pulsar 替代 NSQ、Kafka 或 RocketMQ。该实现包含 JWT 认证支持、便于部署的 Docker Compose 配置,并与现有 EventBus 接口完全兼容。独占订阅模式确保了事件处理的更好消息顺序,非常适合需要高吞吐量和强一致性保证的生产环境。
(Optional) Which issue(s) this PR fixes:
N/A - This is a new feature enhancement