2 回答

TA貢獻1796條經(jīng)驗 獲得超7個贊
嘗試這樣的事情:
func publishMessageToChan(queue *amqp.Queue, channel *amqp.Channel, messageToQueue string) error {
return channel.Publish(
"<exchange>", // exchange
"<queue>", // routing key
false, // mandatory
false, // immediate
amqp.Publishing{
Timestamp: time.Now(),
ContentType: "text/plain",
Body: []byte(messageToQueue),
Priority: 0, // <-- Priority here < 0 to 9>
})
}
使用庫“github.com/streadway/amqp”

TA貢獻1828條經(jīng)驗 獲得超13個贊
var brokerOpts broker.PublishOptions
rabbitmq.Priority(uint8(10))(&brokerOpts)
event.Publish(ctx, payload, client.PublishContext(brokerOpts.Context))
- 2 回答
- 0 關注
- 165 瀏覽
添加回答
舉報