[Go] Fix data race in receiveMessage for push and simple consumers (#1275) The err and resps variables were shared between the main goroutine and a spawned goroutine without synchronization, causing a data race detectable by Go's race detector. The goroutine wrote to both variables while the select handler read them concurrently. Move resps and err into the goroutine as local variables, and pass results back through a typed channel (receiveResult struct) instead. This also fixes push_consumer.go not signaling the done channel on non-EOF errors, which previously caused it to wait for context timeout instead of returning the actual error immediately. Affected: - golang/push_consumer.go: receiveMessage() - golang/simple_consumer.go: receiveMessage() Co-authored-by: guyinyou <guyinyou.gyy@alibaba-inc.com>
English | 简体中文 | RocketMQ Website
Client bindings for Apache RocketMQ, as known as RocketMQ 5.x SDK. All of them follow the specification of rocketmq-apis, replacing 4.x remoting-based counterparts. Clients in this repository are built on top of Protocol Buffers and gRPC.
Provide cloud-native and robust solutions for Java, C++, C#, Golang, Rust and all other mainstream programming languages.
| Feature | Java | C/C++ | C# | Golang | Rust | Python | Node.js | PHP |
|---|---|---|---|---|---|---|---|---|
| Producer with standard messages | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | 🚧 |
| Producer with FIFO messages | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | 🚧 |
| Producer with timed/delay messages | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | 🚧 |
| Producer with transactional messages | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | 🚧 |
| Producer with recalling timed/delay messages | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | 🚧 |
| Simple consumer | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | 🚧 |
| Push consumer with concurrent message listener | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | 🚧 |
| Push consumer with FIFO message listener | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | 🚧 |
| Push consumer with FIFO consume accelerator | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | 🚧 |
| Priority Message | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | 🚧 |
This project is organized as a monorepo, with each language's bindings containing specific instructions in their respective subdirectories for building the project. As the rocketmq-apis submodule is incorporated into the project and could be utilized by some bindings, we highly advise cloning the repository by executing the command below:
git clone --recursive git@github.com:apache/rocketmq-clients.git
Similar to other projects of Apache RocketMQ, any attempt to make this project better is welcome, including but not limited to filing a bug report, correcting type error or document writing to complete feature implementation. Do not hesitate to make a pull request if this project catches your attention.
Apache License, Version 2.0 Copyright (C) Apache Software Foundation