package main import ( "demo3/rabbitmq/RabbitMQ" "fmt" ) func main() { rabbitmq := RabbitMQ.NewRabbitMQ("amqp://lxz:lxz664278@106.54.33.152:5672/lxz") if rabbitmq.Conn == nil { fmt.Println("rabbitmq is nil") } rabbitmq.Close() if rabbitmq.Conn == nil { fmt.Println("rabbitmq is nil") } if rabbitmq.Conn.IsClosed() { fmt.Println("rabbitmq is closed") } // //type Message struct { // Id string `json:"id"` // Method string `json:"method"` // Body []byte `json:"body"` //} // //var msg = Message{ // Id: "1", // Method: "ra", // Body: []byte(`{"name":"ra"}`), //} //for i := 1; i < 10; i++ { // msg.Id = strconv.Itoa(i) // m, _ := json.Marshal(msg) // rabbitmq.Pub(m, "Agent_Exchange", "192.168.2.122") //} }