package com.persagy.person.mq; import org.springframework.amqp.core.Message; import org.springframework.amqp.rabbit.connection.CorrelationData; import org.springframework.amqp.rabbit.core.RabbitTemplate; import lombok.extern.slf4j.Slf4j; /** * @version * @description * @company persagy * @author zhangqiankun * @since 2021年3月29日: 下午3:59:52 */ @Slf4j public class CommonConfirmCallback implements RabbitTemplate.ConfirmCallback { @Override public void confirm(CorrelationData correlationData, boolean ack, String cause) { Message message = correlationData.getReturnedMessage(); String msg = new String(message.getBody()); log.info("correlationData: " + correlationData); log.info("correlationData msg: " + msg); log.info("ack: " + ack); log.info("cause: " + cause); } }