MqttMsgSchedule.java 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. package com.care.mqtt.schedule;
  2. import com.care.mqtt.service.MqttMsgRedisService;
  3. import org.apache.logging.log4j.LogManager;
  4. import org.apache.logging.log4j.Logger;
  5. import org.springframework.beans.factory.annotation.Autowired;
  6. import org.springframework.context.annotation.Configuration;
  7. import org.springframework.scheduling.annotation.EnableScheduling;
  8. import org.springframework.scheduling.annotation.Scheduled;
  9. /** 手动外呼话单调度
  10. * @author 许明
  11. * @version 2.7.0.0 创建于 2018/7/16
  12. **/
  13. @Configuration
  14. @EnableScheduling
  15. public class MqttMsgSchedule {
  16. private static final Logger logger = LogManager.getLogger(MqttMsgSchedule.class);
  17. @Autowired
  18. private MqttMsgRedisService mqttMsgRedisService;
  19. /**
  20. * 10 秒钟调用一次
  21. */
  22. @Scheduled(cron = "0/10 * * * * ?")
  23. public void rotationRedis() {
  24. try {
  25. mqttMsgRedisService.rotationRedis();
  26. } catch (Exception e) {
  27. logger.error("轮训redis出错:{}", e.getMessage());
  28. }
  29. }
  30. }