From 15fbe0f14ad2177b464abaafb4fede1c22a9a74e Mon Sep 17 00:00:00 2001 From: caixiang <939387484@qq.com> Date: Tue, 7 Sep 2021 15:11:59 +0800 Subject: [PATCH] mark for doc --- .../qgs/dc/mq/configuration/ConfigOf00B.java | 18 ++++++++++-------- .../qgs/dc/mq/configuration/ConfigOf00C.java | 16 ++++++++-------- .../configuration/ConfigOfDeadLetterQueue.java | 8 ++++---- .../mq/consumer/DeadLetterQueueReceived.java | 4 ++-- 4 files changed, 24 insertions(+), 22 deletions(-) diff --git a/src/main/java/com/qgs/dc/mq/configuration/ConfigOf00B.java b/src/main/java/com/qgs/dc/mq/configuration/ConfigOf00B.java index 4075224..688c7e4 100644 --- a/src/main/java/com/qgs/dc/mq/configuration/ConfigOf00B.java +++ b/src/main/java/com/qgs/dc/mq/configuration/ConfigOf00B.java @@ -40,24 +40,26 @@ public class ConfigOf00B { public Queue MES_REQUEST_QUEUE_00B(){ Queue queue = new Queue(MES_REQUEST_QUEUE_00B); queue.addArgument("x-dead-letter-exchange",ConfigOfDeadLetterQueue.EXCHANGE_NAME_DLE); - queue.addArgument("x-dead-letter-routing-key",ConfigOfDeadLetterQueue.EAP_REQUEST_QUEUE_ROUTINGKEY_DLE); - queue.addArgument("x-max-priority",ConfigOfDeadLetterQueue.MAX_PRIORITY); + queue.addArgument("x-dead-letter-routing-key",ConfigOfDeadLetterQueue.Dead_Letter_RoutingKey); + //queue.addArgument("x-max-priority",ConfigOfDeadLetterQueue.MAX_PRIORITY); return queue; } @Bean public Queue MES_RESPONSE_QUEUE_00B(){ Queue queue = new Queue(MES_RESPONSE_QUEUE_00B); queue.addArgument("x-dead-letter-exchange",ConfigOfDeadLetterQueue.EXCHANGE_NAME_DLE); - queue.addArgument("x-dead-letter-routing-key",ConfigOfDeadLetterQueue.EAP_REQUEST_QUEUE_ROUTINGKEY_DLE); - queue.addArgument("x-max-priority",ConfigOfDeadLetterQueue.MAX_PRIORITY); + queue.addArgument("x-dead-letter-routing-key",ConfigOfDeadLetterQueue.Dead_Letter_RoutingKey); + //queue.addArgument("x-max-priority",ConfigOfDeadLetterQueue.MAX_PRIORITY); return queue; } + + @Bean public Queue EAP_REQUEST_QUEUE_00B(){ Queue queue = new Queue(EAP_REQUEST_QUEUE_00B); queue.addArgument("x-dead-letter-exchange",ConfigOfDeadLetterQueue.EXCHANGE_NAME_DLE); - queue.addArgument("x-dead-letter-routing-key",ConfigOfDeadLetterQueue.EAP_REQUEST_QUEUE_ROUTINGKEY_DLE); - queue.addArgument("x-max-priority",ConfigOfDeadLetterQueue.MAX_PRIORITY); + queue.addArgument("x-dead-letter-routing-key",ConfigOfDeadLetterQueue.Dead_Letter_RoutingKey); + //queue.addArgument("x-max-priority",ConfigOfDeadLetterQueue.MAX_PRIORITY); return queue; } @@ -65,8 +67,8 @@ public class ConfigOf00B { public Queue EAP_RESPONSE_QUEUE_00B(){ Queue queue = new Queue(EAP_RESPONSE_QUEUE_00B); queue.addArgument("x-dead-letter-exchange",ConfigOfDeadLetterQueue.EXCHANGE_NAME_DLE); - queue.addArgument("x-dead-letter-routing-key",ConfigOfDeadLetterQueue.EAP_REQUEST_QUEUE_ROUTINGKEY_DLE); - queue.addArgument("x-max-priority",ConfigOfDeadLetterQueue.MAX_PRIORITY); + queue.addArgument("x-dead-letter-routing-key",ConfigOfDeadLetterQueue.Dead_Letter_RoutingKey); + //queue.addArgument("x-max-priority",ConfigOfDeadLetterQueue.MAX_PRIORITY); return queue; } diff --git a/src/main/java/com/qgs/dc/mq/configuration/ConfigOf00C.java b/src/main/java/com/qgs/dc/mq/configuration/ConfigOf00C.java index e0f1b65..a20a270 100644 --- a/src/main/java/com/qgs/dc/mq/configuration/ConfigOf00C.java +++ b/src/main/java/com/qgs/dc/mq/configuration/ConfigOf00C.java @@ -41,8 +41,8 @@ public class ConfigOf00C { public Queue MES_REQUEST_QUEUE_00C(){ Queue queue = new Queue(MES_REQUEST_QUEUE_00C); queue.addArgument("x-dead-letter-exchange",ConfigOfDeadLetterQueue.EXCHANGE_NAME_DLE); - queue.addArgument("x-dead-letter-routing-key",ConfigOfDeadLetterQueue.EAP_REQUEST_QUEUE_ROUTINGKEY_DLE); - queue.addArgument("x-max-priority",ConfigOfDeadLetterQueue.MAX_PRIORITY); + queue.addArgument("x-dead-letter-routing-key",ConfigOfDeadLetterQueue.Dead_Letter_RoutingKey); + //queue.addArgument("x-max-priority",ConfigOfDeadLetterQueue.MAX_PRIORITY); return queue; } @@ -50,16 +50,16 @@ public class ConfigOf00C { public Queue MES_RESPONSE_QUEUE_00C(){ Queue queue = new Queue(MES_RESPONSE_QUEUE_00C); queue.addArgument("x-dead-letter-exchange",ConfigOfDeadLetterQueue.EXCHANGE_NAME_DLE); - queue.addArgument("x-dead-letter-routing-key",ConfigOfDeadLetterQueue.EAP_REQUEST_QUEUE_ROUTINGKEY_DLE); - queue.addArgument("x-max-priority",ConfigOfDeadLetterQueue.MAX_PRIORITY); + queue.addArgument("x-dead-letter-routing-key",ConfigOfDeadLetterQueue.Dead_Letter_RoutingKey); + //queue.addArgument("x-max-priority",ConfigOfDeadLetterQueue.MAX_PRIORITY); return queue; } @Bean public Queue EAP_REQUEST_QUEUE_00C(){ Queue queue = new Queue(EAP_REQUEST_QUEUE_00C); queue.addArgument("x-dead-letter-exchange",ConfigOfDeadLetterQueue.EXCHANGE_NAME_DLE); - queue.addArgument("x-dead-letter-routing-key",ConfigOfDeadLetterQueue.EAP_REQUEST_QUEUE_ROUTINGKEY_DLE); - queue.addArgument("x-max-priority",ConfigOfDeadLetterQueue.MAX_PRIORITY); + queue.addArgument("x-dead-letter-routing-key",ConfigOfDeadLetterQueue.Dead_Letter_RoutingKey); + //queue.addArgument("x-max-priority",ConfigOfDeadLetterQueue.MAX_PRIORITY); return queue; } @@ -67,8 +67,8 @@ public class ConfigOf00C { public Queue EAP_RESPONSE_QUEUE_00C(){ Queue queue = new Queue(EAP_RESPONSE_QUEUE_00C); queue.addArgument("x-dead-letter-exchange",ConfigOfDeadLetterQueue.EXCHANGE_NAME_DLE); - queue.addArgument("x-dead-letter-routing-key",ConfigOfDeadLetterQueue.EAP_REQUEST_QUEUE_ROUTINGKEY_DLE); - queue.addArgument("x-max-priority",ConfigOfDeadLetterQueue.MAX_PRIORITY); + queue.addArgument("x-dead-letter-routing-key",ConfigOfDeadLetterQueue.Dead_Letter_RoutingKey); + //queue.addArgument("x-max-priority",ConfigOfDeadLetterQueue.MAX_PRIORITY); return queue; } diff --git a/src/main/java/com/qgs/dc/mq/configuration/ConfigOfDeadLetterQueue.java b/src/main/java/com/qgs/dc/mq/configuration/ConfigOfDeadLetterQueue.java index 794853c..325200a 100644 --- a/src/main/java/com/qgs/dc/mq/configuration/ConfigOfDeadLetterQueue.java +++ b/src/main/java/com/qgs/dc/mq/configuration/ConfigOfDeadLetterQueue.java @@ -27,13 +27,13 @@ public class ConfigOfDeadLetterQueue { * 所以 MES-Received 处理异常的 Message 都会被 投递到 Dead_Letter_Exchange => Dead_Letter_Queue(这个队列) */ public static final String EXCHANGE_NAME_DLE = "Dead_Letter_Exchange"; - public static final String EAP_REQUEST_QUEUE_DLE = "Dead_Letter_Queue"; - public static final String EAP_REQUEST_QUEUE_ROUTINGKEY_DLE = "DL_For_MESReceived_Rk"; + public static final String Dead_Letter_Queue = "Dead_Letter_Queue"; + public static final String Dead_Letter_RoutingKey = "Dead_Letter_RoutingKey"; public static final Integer MAX_PRIORITY = 10; @Bean public Queue EAP_REQUEST_QUEUE_DLE(){ - Queue queue = new Queue(EAP_REQUEST_QUEUE_DLE); + Queue queue = new Queue(Dead_Letter_Queue); queue.setIgnoreDeclarationExceptions(true); return queue; @@ -47,6 +47,6 @@ public class ConfigOfDeadLetterQueue { @Bean public Binding EAP_REQUEST_QUEUE_ROUTINGKEY_DLE(){ return BindingBuilder.bind(EAP_REQUEST_QUEUE_DLE()).to(EXCHANGE_NAME_DLE()) - .with(EAP_REQUEST_QUEUE_ROUTINGKEY_DLE); + .with(Dead_Letter_RoutingKey); } } diff --git a/src/main/java/com/qgs/dc/mq/consumer/DeadLetterQueueReceived.java b/src/main/java/com/qgs/dc/mq/consumer/DeadLetterQueueReceived.java index a08b5d1..f0de946 100644 --- a/src/main/java/com/qgs/dc/mq/consumer/DeadLetterQueueReceived.java +++ b/src/main/java/com/qgs/dc/mq/consumer/DeadLetterQueueReceived.java @@ -25,9 +25,9 @@ public class DeadLetterQueueReceived { // ) - @RabbitListener(queues = ConfigOfDeadLetterQueue.EAP_REQUEST_QUEUE_DLE) + @RabbitListener(queues = ConfigOfDeadLetterQueue.Dead_Letter_Queue) @RabbitHandler - public void dlForPID00B(Message message, Channel channel)throws Exception{ + public void deadLetterQueue(Message message, Channel channel)throws Exception{ System.out.println("线程名"+Thread.currentThread().hashCode()+"==============Dead_Letter_Exchange=================,"+",attr2"+message.getHeaders().get("attr2"));