GitHub user loringgit added a comment to the discussion: Golang Client 
同时消费topic的问题

一个SimpleConsumer订阅多个topic,开启多个goroutine Receive消息的模式,需要对client进行调整,思路入下:
1)对Receive函数增加一个topic参数,比如ReceiveByTopic,
2)Start方法后,对每个topic开启goroutine,调用ReceiveByTopic
'''
func (sc *defaultSimpleConsumer) ReceiveByTopic(ctx context.Context, topic 
string, maxMessageNum int32, invisibleDuration time.Duration) ([]*MessageView, 
error) {
  
   ...这部份逻辑与Receive 类似
}
''''
多个goroutine 对同一个SimpleConsumer的场景,目前的client 代码是否足够线程安全?

GitHub link: 
https://github.com/apache/rocketmq/discussions/9277#discussioncomment-12635880

----
This is an automatically sent email for dev@rocketmq.apache.org.
To unsubscribe, please send an email to: dev-unsubscr...@rocketmq.apache.org

Reply via email to