| | |
| | | package com.smartor.config; |
| | | |
| | | import org.springframework.amqp.AmqpException; |
| | | import org.springframework.amqp.core.*; |
| | | import org.springframework.amqp.rabbit.connection.CorrelationData; |
| | | import org.springframework.amqp.rabbit.core.RabbitTemplate; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | import java.util.UUID; |
| | | |
| | | @Component |
| | | public class RabbitMqCallPhoneConfig { |
| | |
| | | private AmqpAdmin amqpAdmin; |
| | | |
| | | @Autowired |
| | | private AmqpTemplate rabbitTemplate; |
| | | private RabbitTemplate rabbitTemplate; |
| | | |
| | | /** |
| | | * 创建交换机 |
| | |
| | | * @param data 消息 |
| | | */ |
| | | public void sendMessage(String changeName, String routingKey, String data, Long times) { |
| | | |
| | | this.rabbitTemplate.convertAndSend(changeName, routingKey, data, message -> { |
| | | //注意这里时间可以使long,而且是设置header |
| | | message.getMessageProperties().setHeader("x-delay", times); |