apache / rocketmq-client-go

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

使用阿里云RocketMQ时无法批量发送消息,报错:request code unsupported, code 320 #921

Closed KilluaaaCHEN closed 2 years ago

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

版本信息

zhl19970919 commented 2 years ago

貌似是因为阿里云mq本身不支持批量

ShannonDing commented 2 years ago

建议到阿里云提工单咨询一下是否支持。