1、代码编写
1、生产者代码:
/**
* @className com.echo.rm.demo.Producer_Routing
* @author Echo
* @description 路由模式-生产者
* @updateTime 2021/12/27 21:01
* @version 1.0
*/
public class Producer_Routing {
public static void main(String[] args) throws IOException, TimeoutException {
// 1、获取连接
ConnUtils cs = new ConnUtils();
Connection connection = cs.getConnection();
// 2、创建通道
Channel channel = connection.createChannel();
// 3、创建交换机
String exchangeName = "test_direct";
channel.exchangeDeclare(exchangeName, BuiltinExchangeType.DIRECT,true,false,false,null);
// 4、创建队列
String queue1Name = "test_direct_queue1";
String queue2Name = "test_direct_queu