CommonConfirmCallback.java 807 B

1234567891011121314151617181920212223242526272829
  1. package com.persagy.person.mq;
  2. import org.springframework.amqp.core.Message;
  3. import org.springframework.amqp.rabbit.connection.CorrelationData;
  4. import org.springframework.amqp.rabbit.core.RabbitTemplate;
  5. import lombok.extern.slf4j.Slf4j;
  6. /**
  7. * @version
  8. * @description
  9. * @company persagy
  10. * @author zhangqiankun
  11. * @since 2021年3月29日: 下午3:59:52
  12. */
  13. @Slf4j
  14. public class CommonConfirmCallback implements RabbitTemplate.ConfirmCallback {
  15. @Override
  16. public void confirm(CorrelationData correlationData, boolean ack, String cause) {
  17. Message message = correlationData.getReturnedMessage();
  18. String msg = new String(message.getBody());
  19. log.info("correlationData: " + correlationData);
  20. log.info("correlationData msg: " + msg);
  21. log.info("ack: " + ack);
  22. log.info("cause: " + cause);
  23. }
  24. }