GitHub user francisoliverlee 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
> 代码是否足够线程安全?
这里其实需要一个push consumer,简化消费操作。如果你有好的实现可以分享出来
GitHub link:
https://github.com/apache/rocketmq/discussions/9277#discussioncomment-12647801
----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]