Closed yfanswer closed 1 year ago
func (pc *PullConsumer) Poll(ctx context.Context, topic string) error { logger := logx.WithContext(ctx)
if err := pc.pullConsumer.Subscribe(topic, consumer.MessageSelector{}); err != nil {
return perrors.WithStack(err)
}
if err := pc.Start(); err != nil {
return err
}
for {
cr, err := pc.pullConsumer.Poll(ctx, 5*time.Second)
if err != nil {
logger.Errorf("consumer poll failed, error:%+v", err)
continue
}
//TODO: LOGIC CODE HERE
logger.Infof("rocketmq pull result:%#v", *cr)
logger.Info("msgList:", cr.GetMsgList())
logger.Info("messageQueue:", cr.GetMQ())
logger.Info("processQueue:", cr.GetPQ())
// pullConsumer.ACK(context.TODO(), cr, consumer.ConsumeRetryLater)
pc.pullConsumer.ACK(ctx, cr, consumer.ConsumeSuccess)
}
}
版本:github.com/apache/rocketmq-client-go/v2 v2.1.2-0.20221031113948-c197b50c3176
i have the same question, how to resolve it
使用sdk后报错:unknown Response Code: 15, remark: the pull consumer is not supported for current client, please upgrade version to 5.0.0 and above