Closed KilluaaaCHEN closed 2 years ago
p, err := rocketmq.NewProducer( producer.WithNsResolver(primitive.NewPassthroughResolver([]string{"10.1.2.3.4:8080"})), producer.WithRetry(2), producer.WithCredentials(primitive.Credentials{ AccessKey: "111", SecretKey: "222", }), ) if err != nil { fmt.Println("init producer error: " + err.Error()) os.Exit(0) } err = p.Start() if err != nil { fmt.Printf("start producer error: %s", err.Error()) os.Exit(1) } msg1 := primitive.NewMessage("debug-topic", []byte("msg1")) msg2 := primitive.NewMessage("debug-topic", []byte("msg2")) rst, err := p.SendSync(context.Background(), msg1, msg2) if err != nil { fmt.Printf("SendSync error: %s", err.Error()) os.Exit(1) } fmt.Println(rst)
SendSync error: request code unsupported, code 320
貌似是因为阿里云mq本身不支持批量
建议到阿里云提工单咨询一下是否支持。
代码片段
运行报错:
版本信息