| | |
| | | public static final String QUEUE_DELAY = "queue.delay"; |
| | | public static final String EXCHANGE_DELAY = "exchange.delay"; |
| | | |
| | | public static final String QUEUE_MSG_HISTORY = "queue_msg_history"; |
| | | public static final String ROUTING_KEY_MSG_HISTORY = "routing_key_msg_history"; |
| | | |
| | | @Resource |
| | | private ConnectionFactory connectionFactory; |
| | | |
| | |
| | | params.put("x-dead-letter-exchange", EXCHANGE_DELAY); |
| | | // x-dead-letter-routing-key 声明了这些死信在转发时携带的 routing-key 名称。 |
| | | params.put("x-dead-letter-routing-key", ROUTING_KEY_DELAY); |
| | | params.put("x-message-ttl", 6000); |
| | | // params.put("x-message-ttl", 6000); |
| | | return new Queue(QUEUE_DELAY, true, false, false, params); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | @Bean |
| | | public Queue msgHistoryQueue() { |
| | | return new Queue(QUEUE_MSG_HISTORY); |
| | | } |
| | | |
| | | @Bean |
| | | public Binding msgHistoryBinding() { |
| | | return BindingBuilder.bind(msgHistoryQueue()).to(defaultExchange()).with(ROUTING_KEY_MSG_HISTORY); |
| | | } |
| | | |
| | | @Bean |
| | | public Queue testQueue() { |
| | | return new Queue(QUEUE_TEST, true); |
| | | } |