From 2ee6f92815ea7920a1009acde3c74f55286c5e85 Mon Sep 17 00:00:00 2001 From: wj <1285151836@qq.com> Date: Tue, 17 Oct 2023 18:15:51 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/config/rabbit/TopicRabbitConfig.java | 40 ++++++++++++------- .../com/glxp/api/upload/uploadController.java | 2 +- src/main/resources/application.yml | 1 + 3 files changed, 27 insertions(+), 16 deletions(-) diff --git a/src/main/java/com/glxp/api/config/rabbit/TopicRabbitConfig.java b/src/main/java/com/glxp/api/config/rabbit/TopicRabbitConfig.java index 5139db2..08d5d0f 100644 --- a/src/main/java/com/glxp/api/config/rabbit/TopicRabbitConfig.java +++ b/src/main/java/com/glxp/api/config/rabbit/TopicRabbitConfig.java @@ -24,7 +24,17 @@ public class TopicRabbitConfig { @Bean public Queue traceQueue() { - return new Queue(TopicRabbitConfig.trace); + Map args = new HashMap<>(16); + // 设置当前队列绑定的死信交换机 + args.put("x-dead-letter-exchange", TRACE_DELAY_EXCHANGE); + // 设置当前队列的死信路由key + args.put("x-dead-letter-routing-key", "trace.delay.*"); + + args.put("x-message-ttl", 1000*60*20); + return QueueBuilder + .durable(trace) + .withArguments(args) + .build(); } @Bean @@ -37,13 +47,6 @@ public class TopicRabbitConfig { return new Queue(TopicRabbitConfig.publicer); } - @Bean - public Queue traceDelayQueue() { - return QueueBuilder - .durable(delaytrace) - .build(); - } - @Bean TopicExchange exchange() { return new TopicExchange(TRACE_TOPIC_EXCHANGE); @@ -51,9 +54,10 @@ public class TopicRabbitConfig { @Bean public Exchange traceDelayExchange() { - Map args = new HashMap<>(1); - args.put("x-delayed-type", "topic"); - return new CustomExchange(TRACE_DELAY_EXCHANGE, "x-delayed-message", true, false, args); + return new TopicExchange(TRACE_DELAY_EXCHANGE); +// Map args = new HashMap<>(1); +// args.put("x-delayed-type", "topic"); +// return new CustomExchange(TRACE_DELAY_EXCHANGE, "x-delayed-message", true, false, args); } @Bean @@ -68,15 +72,21 @@ public class TopicRabbitConfig { @Bean - public Binding orderBinding(Queue traceDelayQueue, Exchange traceDelayExchange) { + public Queue traceDelayQueue() { + return QueueBuilder + .durable(delaytrace) + .build(); + } + + @Bean + public Binding orderBinding() { return BindingBuilder - .bind(traceDelayQueue) - .to(traceDelayExchange) + .bind(traceDelayQueue()) + .to(traceDelayExchange()) .with("trace.delay.*") .noargs(); } - } diff --git a/src/main/java/com/glxp/api/upload/uploadController.java b/src/main/java/com/glxp/api/upload/uploadController.java index 3afd7d6..339da68 100644 --- a/src/main/java/com/glxp/api/upload/uploadController.java +++ b/src/main/java/com/glxp/api/upload/uploadController.java @@ -30,7 +30,7 @@ public class uploadController { private String filePath; @Value("${minio_path}") private String minioPath; - @Value("${minio_url}") + @Value("${minio.endpoint}") private String minioUrl; /** diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 80e18f1..fc1e65c 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -37,3 +37,4 @@ server: max-http-header-size: 100MB +minio_path: /udiCpt