You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by GitBox <gi...@apache.org> on 2022/11/01 09:23:50 UTC

[GitHub] [rocketmq-client-go] yfanswer commented on issue #954: 报错: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 on issue #954:
URL: https://github.com/apache/rocketmq-client-go/issues/954#issuecomment-1298256159

   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)
   	}
   }


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org