|
|
|
@ -24,7 +24,17 @@ public class TopicRabbitConfig {
|
|
|
|
|
|
|
|
|
|
@Bean
|
|
|
|
|
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
|
|
|
|
@ -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<String, Object> 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<String, Object> 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();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|