import org.springblade.gis.rabbitmq.confirm.RabbitReturnCallback;
import org.springblade.gis.rabbitmq.confirm.RabbitConfirmCallback;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.core.MessageProperties;
import org.springframework.amqp.rabbit.connection.CorrelationData;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
@Component
@Slf4j
public class RabbitSender implements InitializingBean {
@Resource
private RabbitTemplate rabbitTemplate;
/**
-
异步 对外发送消息的方法
-
@param msgId &msg 具体的消息内容
-
@throws Exception
*/
public void syncSend(String msgId,String msg) {
MessageProperties messageProperties=new MessageProperties();
messageProperties.setMessageId(msgId);
Message message=new Message(msg.getBytes(StandardCharsets.UTF_8),messageProperties);
CorrelationData data = new CorrelationData(UUID.randomUUID().toString());
rabbitTemplate.convertAndSe