[agent-go] 完成RabbitMQ连接部分的代码

This commit is contained in:
zeaslity
2023-03-21 17:08:22 +08:00
parent 1c57a631d9
commit fe8a4a03fc
19 changed files with 482 additions and 93 deletions

View File

@@ -0,0 +1,20 @@
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,
},
)
}