import java.util.HashMap;
@Configuration
public class MyRabbitMQConfig {
@Autowired(required = false)
private ItsmQuestionnairesSendingConfigMapper configMapper;
@Bean
public org.springframework.amqp.core.Queue orderDelayQueue() {
Integer recycltime = 10;
ItsmQuestionnairesSendingConfig config = configMapper.selectOne(null);
if (config != null){
recycltime = config.getDefaultRecycltime();
recycltime = recycltime * 24 * 3600;
}
HashMap<String, Object> arguments = new HashMap<>();
arguments.put("x-dead-letter-exchange", "order-event-exchange");
arguments.put("x-dead-letter-routing-key", "order.release.order");
arguments.put("x-message-ttl", recycltime * 1000);
return new org.springframework.amqp.core.Queue("order.delay.queue", true, false, false, arguments);
}
@Bean
public Queue orderReleaseQueue() {
return new org.springframework.amqp.core.Queue("order.release.order.queue", true, false, false);
}
@Bean
public Exchange orderEventExchange() {
return new TopicExchange("order-event-exchange", true, false);
}
@Bean
public Binding orderCreateBinding() {
return new Binding("order.delay.queue",
Binding.DestinationType.QUEUE,
"order-event-exchange",
"order.create.order",
null);
}
@Bean
public Binding orderReleaseBinding() {
return new Binding("order.release.order.queue",
Binding.DestinationType.QUEUE,
"order-event-exchange",
"order.release.order",
null);
}
}
本作品採用《CC 協議》,轉載必須註明作者和本文連結