master
wj 1 year ago
parent fef372c30d
commit 2ee6f92815

@ -24,7 +24,17 @@ public class TopicRabbitConfig {
@Bean @Bean
public Queue traceQueue() { public Queue traceQueue() {
return new Queue(TopicRabbitConfig.trace); Map<String, Object> 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 @Bean
@ -37,13 +47,6 @@ public class TopicRabbitConfig {
return new Queue(TopicRabbitConfig.publicer); return new Queue(TopicRabbitConfig.publicer);
} }
@Bean
public Queue traceDelayQueue() {
return QueueBuilder
.durable(delaytrace)
.build();
}
@Bean @Bean
TopicExchange exchange() { TopicExchange exchange() {
return new TopicExchange(TRACE_TOPIC_EXCHANGE); return new TopicExchange(TRACE_TOPIC_EXCHANGE);
@ -51,9 +54,10 @@ public class TopicRabbitConfig {
@Bean @Bean
public Exchange traceDelayExchange() { public Exchange traceDelayExchange() {
Map<String, Object> args = new HashMap<>(1); return new TopicExchange(TRACE_DELAY_EXCHANGE);
args.put("x-delayed-type", "topic"); // Map<String, Object> args = new HashMap<>(1);
return new CustomExchange(TRACE_DELAY_EXCHANGE, "x-delayed-message", true, false, args); // args.put("x-delayed-type", "topic");
// return new CustomExchange(TRACE_DELAY_EXCHANGE, "x-delayed-message", true, false, args);
} }
@Bean @Bean
@ -68,15 +72,21 @@ public class TopicRabbitConfig {
@Bean @Bean
public Binding orderBinding(Queue traceDelayQueue, Exchange traceDelayExchange) { public Queue traceDelayQueue() {
return QueueBuilder
.durable(delaytrace)
.build();
}
@Bean
public Binding orderBinding() {
return BindingBuilder return BindingBuilder
.bind(traceDelayQueue) .bind(traceDelayQueue())
.to(traceDelayExchange) .to(traceDelayExchange())
.with("trace.delay.*") .with("trace.delay.*")
.noargs(); .noargs();
} }
} }

@ -30,7 +30,7 @@ public class uploadController {
private String filePath; private String filePath;
@Value("${minio_path}") @Value("${minio_path}")
private String minioPath; private String minioPath;
@Value("${minio_url}") @Value("${minio.endpoint}")
private String minioUrl; private String minioUrl;
/** /**

@ -37,3 +37,4 @@ server:
max-http-header-size: 100MB max-http-header-size: 100MB
minio_path: /udiCpt

Loading…
Cancel
Save