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/12/14 09:19:04 UTC

[GitHub] [rocketmq-client-go] codinl edited a comment on issue #569: Dose this lib support aliyun rocketmq?

codinl edited a comment on issue #569:
URL: https://github.com/apache/rocketmq-client-go/issues/569#issuecomment-744300862


   I use like below, but have the error:  'query topic route from server error" underlayError="topic not exist"'
   
   ```	
   p, _ := rocketmq.NewProducer(
   		producer.WithNameServer([]string{"my url"}),
   		producer.WithInstanceName("MY Instance"),
   		producer.WithRetry(2),
   		producer.WithGroupName("MY GROUP"),
   		producer.WithQueueSelector(producer.NewManualQueueSelector()),
   		producer.WithCredentials(primitive.Credentials{
   			AccessKey: "my AccessKey",
   			SecretKey: "my SecretKey",
   		}),
   		//producer.WithCreateTopicKey("test"),
   	)
   
   	err := p.Start()
   	if err != nil {
   		log.Error().Msgf("start producer error: %s", err.Error())
   		os.Exit(1)
   	}
   
   	topic := "test"
   
   	for i := 0; i < 10; i++ {
   		msg := &primitive.Message{
   			Topic: topic,
   			Body:  []byte("Hello RocketMQ Go Client! " + strconv.Itoa(i)),
   		}
   		res, err := p.SendSync(context.Background(), msg)
   
   		if err != nil {
   			log.Error().Msgf("send message error: %s\n", err)
   		} else {
   			log.Error().Msgf("send message success: result=%s\n", res.String())
   		}
   	}
   	err = p.Shutdown()
   	if err != nil {
   		log.Error().Msgf("shutdown producer error: %s", err.Error())
   	}
   ```


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