apache / rocketmq-client-go

Apache RocketMQ go client
https://rocketmq.apache.org/
Apache License 2.0
1.31k stars 423 forks source link

报错:unknown Response Code: 15, remark: the pull consumer is not supported for current client, please upgrade version to 5.0.0 and above #954

Closed yfanswer closed 1 year ago

yfanswer commented 2 years ago

使用sdk后报错:unknown Response Code: 15, remark: the pull consumer is not supported for current client, please upgrade version to 5.0.0 and above

yfanswer commented 2 years 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)
}

}

yfanswer commented 2 years ago

版本:github.com/apache/rocketmq-client-go/v2 v2.1.2-0.20221031113948-c197b50c3176

chowyu12 commented 1 year ago

i have the same question, how to resolve it