|
@@ -28,26 +28,29 @@ public class MqListeners {
|
|
|
/** 用户用 - 队列名 */
|
|
|
public final static String userQueue = "umsg";
|
|
|
/** 用户用 - 路由匹配 *: 用户唯一标识 */
|
|
|
- public final static String userRouterMatch = userQueue + ".*";
|
|
|
+ public final static String userRouterMatch = "*";
|
|
|
|
|
|
/** 对话用 - 交换机名 */
|
|
|
public final static String exName = "chatEx";
|
|
|
/** 对话用 - 队列名 */
|
|
|
public final static String queueName = "chat";
|
|
|
/** 对话用 - 路由匹配 *: 转人工申请id */
|
|
|
- public final static String routerMatch = queueName + ".*";
|
|
|
+ public final static String routerMatch ="*";
|
|
|
+
|
|
|
+ public final static boolean durable = false;
|
|
|
+ public final static boolean autoDelete = true;
|
|
|
|
|
|
// admin
|
|
|
@Bean()
|
|
|
public Queue adminQueue() {
|
|
|
System.out.println("create " + adminQueue + " queue");
|
|
|
- return new Queue(adminQueue, true);
|
|
|
+ return new Queue(adminQueue, durable);
|
|
|
}
|
|
|
|
|
|
@Bean()
|
|
|
FanoutExchange admiExchange() {
|
|
|
System.out.println("create " + adminExName + " ex");
|
|
|
- FanoutExchange f = new FanoutExchange(adminExName);
|
|
|
+ FanoutExchange f = new FanoutExchange(adminExName, durable, autoDelete);
|
|
|
return f;
|
|
|
}
|
|
|
|
|
@@ -61,13 +64,13 @@ public class MqListeners {
|
|
|
@Bean
|
|
|
public Queue userQueue() {
|
|
|
System.out.println("create " + userQueue + " queue");
|
|
|
- return new Queue(userQueue, true);
|
|
|
+ return new Queue(userQueue, durable);
|
|
|
}
|
|
|
|
|
|
@Bean
|
|
|
TopicExchange userExchange() {
|
|
|
System.out.println("create " + userExName + " ex");
|
|
|
- return new TopicExchange(userExName);
|
|
|
+ return new TopicExchange(userExName, durable, autoDelete);
|
|
|
}
|
|
|
|
|
|
@Bean
|
|
@@ -81,14 +84,14 @@ public class MqListeners {
|
|
|
@Bean
|
|
|
public Queue chatQueue() {
|
|
|
System.out.println("create " + queueName + " queue");
|
|
|
- return new Queue(queueName, true);
|
|
|
+ return new Queue(queueName, durable);
|
|
|
}
|
|
|
|
|
|
/** 声明交换机 */
|
|
|
@Bean
|
|
|
TopicExchange exchange() {
|
|
|
System.out.println("create " + exName + " ex");
|
|
|
- return new TopicExchange(exName);
|
|
|
+ return new TopicExchange(exName, durable, autoDelete);
|
|
|
}
|
|
|
|
|
|
/** 队列绑定交换机 */
|
|
@@ -114,8 +117,8 @@ public class MqListeners {
|
|
|
rabbitAdmin.declareExchange(userExchange());
|
|
|
rabbitAdmin.declareExchange(exchange());
|
|
|
|
|
|
- rabbitAdmin.declareQueue(adminQueue());
|
|
|
- rabbitAdmin.declareQueue(userQueue());
|
|
|
- rabbitAdmin.declareQueue(chatQueue());
|
|
|
+ // rabbitAdmin.declareQueue(adminQueue());
|
|
|
+ // rabbitAdmin.declareQueue(userQueue());
|
|
|
+ // rabbitAdmin.declareQueue(chatQueue());
|
|
|
}
|
|
|
}
|