You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
974 B

  1. package com.example.demo.RabbitMQ;
  2. import com.example.demo.config.RabbitMQConfig;
  3. import com.example.demo.domain.vo.coin.Messages;
  4. import com.example.demo.mapper.coin.OperationLogMapper;
  5. import lombok.extern.slf4j.Slf4j;
  6. import org.springframework.amqp.rabbit.annotation.RabbitListener;
  7. import org.springframework.beans.factory.annotation.Autowired;
  8. import org.springframework.stereotype.Component;
  9. /**
  10. * 金豆充值流程消息消费者
  11. * 监听金豆充值流程中各个状态变更的消息队列
  12. */
  13. @Component
  14. @Slf4j
  15. public class BeanRechargeConsumer {
  16. @Autowired
  17. private OperationLogMapper operationLogMapper;
  18. @RabbitListener(queues = RabbitMQConfig.Bean_RECHARGE_QUEUE)
  19. public void consumeLog(Messages messages) {
  20. try {
  21. operationLogMapper.insertMessage(messages);
  22. } catch (Exception e) {
  23. log.error("持久化金豆充值日志失败", e);
  24. // 可以重试或记录到文件
  25. }
  26. }
  27. }