factory.setHost("192.168.40.132");
factory.setPort(5672);
factory.setUsername("lscl");
factory.setPassword("admin");
factory.setVirtualHost("/lscl");
// 2.创建连接
Connection connection = factory.newConnection();
// 3.创建频道
Channel channel = connection.createChannel();
String exchangeName = "test\_topic";
//5. 创建交换机
channel.exchangeDeclare(exchangeName, BuiltinExchangeType.TOPIC,true,false,false,null);
//6. 创建队列
String queue1Name = "test\_topic\_queue1";
String queue2Name = "test\_topic\_queue2";
String queue3Name = "test\_topic\_queue3";
String queue4Name = "test\_topic\_queue4";
channel.queueDeclare(queue1Name,true,false,false,null);
channel.queueDeclare(queue2Name,true,false,false,null);
channel.queueDeclare(queue3Name,true,false,false,null);
channel.queueDeclare(queue4Name,true,false,false