Closed yeyudekuangxiang closed 1 year ago
Can you provide a bit more context? What do you mean with "fails to send"? Are there error messages?
sorry,i mean i want to call channel.GetNextPublishSeqNo() method before sending message
seqNo := channel.GetNextPublishSeqNo()
Log.Printf("publishing %dB body (%q)", len(body), body)
if err := channel.Publish(
exchange, // publish to an exchange
routingKey, // routing to 0 or more queues
false, // mandatory
false, // immediate
amqp.Publishing{
Headers: amqp.Table{},
ContentType: "text/plain",
ContentEncoding: "",
Body: []byte(body),
DeliveryMode: amqp.Transient, // 1=non-persistent, 2=persistent
Priority: 0, // 0-9
// a bunch of application/implementation-specific fields
},
); err != nil {
return fmt.Errorf("Exchange Publish: %s", err)
}
This looks like a question for the AMQP lib
How to resend a message when it fails to send