goProject/trunk/center/common/rebbitMQ/sendData.go
2025-01-15 17:36:12 +08:00

26 lines
603 B
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package rebbitMQ
import (
configYaml "common/configsYaml"
"github.com/streadway/amqp"
"goutil/logUtilPlus"
)
// 发送单挑mq消息
func sendMqData(data string) {
// 发布消息到队列
err := RabbitMQChannel.Publish(
"", // 交换机名称
configYaml.GetRabbitMQName(), // 路由键
false, // 是否强制
false, // 是否立即
amqp.Publishing{
ContentType: "text/plain",
Body: []byte(data),
})
if err != nil {
logUtilPlus.ErrorLog("Failed to publish a messageerr:%s", err.Error())
}
}