作者 朱兆平

rabbitMQ收发服务客户端

@@ -42,7 +42,7 @@ public class ExSendMsg { @@ -42,7 +42,7 @@ public class ExSendMsg {
42 Connection connection = ConnectionUtil.getConnection(hostIp,hostPort,vHostName,userName,password); 42 Connection connection = ConnectionUtil.getConnection(hostIp,hostPort,vHostName,userName,password);
43 // 从连接中创建通道 43 // 从连接中创建通道
44 Channel channel = connection.createChannel(); 44 Channel channel = connection.createChannel();
45 - // 声明(创建)队列 45 + // 声明(创建)交换
46 channel.exchangeDeclare(exchangeName, exchangeType,true); 46 channel.exchangeDeclare(exchangeName, exchangeType,true);
47 // 消息内容 47 // 消息内容
48 channel.basicPublish(exchangeName, routingKey, null, msg.getBytes(StandardCharsets.UTF_8)); 48 channel.basicPublish(exchangeName, routingKey, null, msg.getBytes(StandardCharsets.UTF_8));