21 lines
382 B
Go
21 lines
382 B
Go
package rabbitmq
|
|
|
|
import "github.com/streadway/amqp"
|
|
|
|
// Send 向RabbitMQ中发送消息
|
|
func Send(conn *RabbitMQConn, connProp *ConnectProperty, message []byte) {
|
|
// 往哪里发
|
|
channel := conn.Channel
|
|
// 发送
|
|
channel.Publish(
|
|
connProp.ExchangeName,
|
|
connProp.TopicKey,
|
|
false,
|
|
true,
|
|
amqp.Publishing{
|
|
ContentType: "text/plain",
|
|
Body: message,
|
|
},
|
|
)
|
|
}
|