You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rocketmq.apache.org by GitBox <gi...@apache.org> on 2020/09/27 09:10:25 UTC

[GitHub] [rocketmq-client-go] Barrett-M82A1 opened a new issue #539: SDK V2 cannot consumption message,trackType is UNKNONW

Barrett-M82A1 opened a new issue #539:
URL: https://github.com/apache/rocketmq-client-go/issues/539


   RocketMQ version is 4.7.0
   SDK "github.com/apache/rocketmq-client-go/v2/consumer"
   
   main.go
   ```
   func main() {
   	c, _ := rocketmq.NewPushConsumer(
   		consumer.WithGroupName("local-node-1"),
   		consumer.WithNsResovler(primitive.NewPassthroughResolver([]string{"192.168.1.220:9876"})),
   	)
   	err := c.Subscribe("SendMessage", consumer.MessageSelector{},increment.Consumer)
   	if err != nil {
   		fmt.Println(err.Error())
   	}
   	// Note: start after subscribe
   	err = c.Start()
   	if err != nil {
   		fmt.Println(err.Error())
   		os.Exit(-1)
   	}
   	time.Sleep(time.Hour)
   	err = c.Shutdown()
   	if err != nil {
   		fmt.Printf("shutdown Consumer error: %s", err.Error())
   	}
   }
   ```
   consumer.go
   ```
   func Consumer(ctx context.Context, msgs ...*primitive.MessageExt) (consumer.ConsumeResult, error) {
   	for i := range msgs {
   		fmt.Printf("subscribe callback: %v \n", msgs[i])
   	}
   
   	return consumer.ConsumeSuccess, nil
   }
   ```
   
   ![截图录屏_选择区域_20200927170731](https://user-images.githubusercontent.com/27344136/94361034-074d9300-00e4-11eb-8f3b-f61b89a2b183.png)
   ![截图录屏_选择区域_20200927170615](https://user-images.githubusercontent.com/27344136/94361041-17657280-00e4-11eb-9a31-8ca2dd4d341f.png)
   


----------------------------------------------------------------
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.

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